「Tep3-onk」を編集中

移動先: 案内検索

警告: ログインしていません。編集を行うと、あなたの IP アドレスが公開されます。ログインまたはアカウントを作成すれば、あなたの編集はその利用者名とともに表示されるほか、その他の利点もあります。

この編集を取り消せます。 下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 編集中の文章
1行目: 1行目:
 
[[category:memo|{{PAGENAME}}]]
 
[[category:memo|{{PAGENAME}}]]
{{Font color}}
 
 
== generate ==
 
== generate ==
  
12行目: 11行目:
  
 
  % rails generate scaffold Other user:references note:references client:references name:string yomi:string client_name:boolean line:integer memo:text generation:string
 
  % rails generate scaffold Other user:references note:references client:references name:string yomi:string client_name:boolean line:integer memo:text generation:string
 
% rails generate scaffold List user:references note:references content:string line:integer
 
  
 
  $ rails generate scaffold Post content:text user:references picture:string
 
  $ rails generate scaffold Post content:text user:references picture:string
41行目: 38行目:
  
 
  $ rails db:migrate:up VERSION=20200504051127
 
  $ rails db:migrate:up VERSION=20200504051127
 
% rails db:migrate:reset
 
  
 
== postgres ==
 
== postgres ==
80行目: 75行目:
 
COPY 3066</nowiki>
 
COPY 3066</nowiki>
  
=== database heroku_dump table dump ===
+
=== table dump ===
 
  ALTER TABLE users RENAME TO users_old;
 
  ALTER TABLE users RENAME TO users_old;
  ALTER TABLE clients RENAME TO clients_old;
 
 
<nowiki>=# select count(*) from clients_old ;
 
count
 
-------
 
  5067
 
(1 row)</nowiki>
 
  
  % pg_dump --username=jq --table clients_old heroku_dump > clients_old.sql
+
  % pg_dump --username=jq --table jq_clients heroku_dump > old_other.sql
  
  <nowiki>% psql --username=jq tep5_development < clients_old.sql    
+
  <nowiki>% psql --username=jq tep5_development < old_other.sql
 
SET
 
SET
 
SET
 
SET
109行目: 97行目:
 
SET
 
SET
 
SET
 
SET
ERROR:  relation "clients_old" already exists
+
CREATE TABLE
 
ALTER TABLE
 
ALTER TABLE
ERROR:  relation "clients_id_seq" already exists
+
COPY 3066
ALTER TABLE
+
</nowiki>
ALTER SEQUENCE
 
ALTER TABLE
 
COPY 5067
 
setval
 
--------
 
  5351
 
(1 row)
 
 
 
ERROR:  relation "clients_pkey" already exists
 
ERROR:  relation "index_clients_on_jiin_id" already exists
 
ERROR:  relation "index_clients_on_user_id" already exists
 
ERROR:  relation "index_clients_on_user_id_and_jiin_id_and_name" already exists
 
ERROR:  relation "index_clients_on_yomi_and_ie_id" already exists
 
ERROR:  there is no unique constraint matching given keys for referenced table "users_old"
 
ERROR:  constraint "fk_rails_de6906508b" for relation "clients_old" already exists</nowiki>
 
  
 
=== ie_id 重複修正 ===
 
=== ie_id 重複修正 ===
143行目: 116行目:
 
   2167 |    2
 
   2167 |    2
 
</nowiki>
 
</nowiki>
 
ie_idを変更する
 
=# update clients_old SET ie_id = ie_id + 20000 where jiin_id = 2;
 
------
 
=# update clients_old SET ie_id = ie_id + 40000 where jiin_id = 4;
 
  
 
  =# select * from clients_old where ie_id = 2090;
 
  =# select * from clients_old where ie_id = 2090;
  
 
  =# update clients_old set ie_id = 6000 where ie_id = 2090 and jiin_id > 1;
 
  =# update clients_old set ie_id = 6000 where ie_id = 2090 and jiin_id > 1;
 
== 親テーブルie_id 子テーブルie_id 差分削除 ==
 
% diff aa_clients_id_ie_id.csv bb_clients_old_ie_id.csv > diff.csv
 
  
 
=== insert ===
 
=== insert ===
188行目: 153行目:
 
where
 
where
 
     nusi = true;
 
     nusi = true;
INSERT 0 1293
 
 
</nowiki>
 
</nowiki>
  
198行目: 162行目:
 
     id, name, yomi, ie_id, nusi, user_id, jiin_id, created_at, updated_at, memo, each_order, generation
 
     id, name, yomi, ie_id, nusi, user_id, jiin_id, created_at, updated_at, memo, each_order, generation
 
from
 
from
     clients_old;
+
     jq_clients;</nowiki>
INSERT 0 4747</nowiki>
 
  
 
=== insert エラー ===
 
=== insert エラー ===
211行目: 174行目:
  
 
  % rails db:migrate:up VERSION=
 
  % rails db:migrate:up VERSION=
 
{{font color||yellow|後で本番環境も変更}}
 
 
不要
 
=# delete from clients_old where id in (4028,3911,3912,2998,3007,4359);
 
 
主重複
 
<nowiki> ie_id | count
 
-------+-------
 
  2282 |    2
 
  3703 |    2
 
(2 rows)
 
 
=# update clients_old set nusi = false where id = 1346;
 
 
=# update clients_old set nusi = false where id = 3703;</nowiki>
 
 
== {{font color||yellow|移動本番でも}} ==
 
update clients_old set nusi = true where id = 523;
 
 
delete from clients_old where id = 845;
 
 
<nowiki>update clients_old set ie_id = 1264 where id = 515;
 
update clients_old set ie_id = 1264 where id = 1463;
 
update clients_old set nusi = false where id = 515;</nowiki>
 
 
delete from clients_old where id = 217;
 
update clients_old set nusi = false where id = 218;
 
update clients_old set ie_id = 204 where id = 218;
 
 
delete from clients_old where id = 811;
 
 
update clients_old set nusi = true where id = 1792;
 
 
delete from clients_old where id = 810;
 
 
delete from clients_old where ie_id = 22653;
 
 
<nowiki>delete from clients_old where ie_id = 22653;
 
DELETE 3
 
tep5_development=# insert into others
 
(
 
    id, name, yomi, client_id, client_name, user_id, note_id, created_at, updated_at, memo, line, generation
 
)
 
select
 
    id, name, yomi, ie_id, nusi, user_id, jiin_id, created_at, updated_at, memo, each_order, generation
 
from
 
    clients_old;
 
INSERT 0 4747</nowiki>
 
  
 
=== 指定行を作る ===
 
=== 指定行を作る ===
278行目: 192行目:
 
;
 
;
 
UPDATE 3066</nowiki>
 
UPDATE 3066</nowiki>
 
=== 作業テーブル削除 ===
 
<nowiki>tep5_development=# drop table clients_old ;
 
DROP TABLE
 
tep5_development=# drop table jq_clients ;
 
DROP TABLE
 
tep5_development=# drop table users_old ;
 
DROP TABLE</nowiki>
 
  
 
== ローカル ==
 
== ローカル ==
411行目: 317行目:
  
 
== 同期 ==
 
== 同期 ==
 
+
% rsync -r ~/rails_app_tepnote/4tep/ host:/home/tep/
 
除外するファイルをまとめる
 
除外するファイルをまとめる
 
  <nowiki>exclude-file.txt
 
  <nowiki>exclude-file.txt
422行目: 328行目:
 
  $ bundle install  --without test development
 
  $ bundle install  --without test development
  
{{font color||yellow|database.yml username:などを確認する (2箇所)}}
+
database.yml username:などを確認する (2箇所)
 
 
{{font color||yellow|migrationファイルがダブったときは削除}}
 
 
 
$ rails db:migrate:status RAILS_ENV=production
 
  
 
  $ rails db:create RAILS_ENV=production
 
  $ rails db:create RAILS_ENV=production
 
  または
 
  または
 
  $ rails db:reset RAILS_ENV=production
 
  $ rails db:reset RAILS_ENV=production
または
 
$ rails db:drop  RAILS_ENV=production
 
または
 
=# drop database mydb;
 
  
 
エラーのとき
 
エラーのとき
452行目: 350行目:
 
daisyuiをインストール
 
daisyuiをインストール
 
  $ yarn add daisyui
 
  $ yarn add daisyui
 
== 参考 ==
 
<nowiki>=# delete from clients_old where ie_id in (21,
 
22,
 
23,
 
24,
 
26,
 
27,
 
30,
 
32,
 
33,
 
34,
 
35,
 
36,
 
39,
 
41,
 
43,
 
44,
 
45,
 
46,
 
48,
 
49,
 
51,
 
52,
 
53,
 
56,
 
57,
 
62,
 
63,
 
64,
 
66,
 
67,
 
68,
 
69,
 
71,
 
73,
 
78,
 
79,
 
80,
 
82,
 
87,
 
90,
 
92,
 
93,
 
94,
 
95,
 
96,
 
97,
 
98,
 
99,
 
100,
 
101,
 
102,
 
104,
 
105,
 
106,
 
108,
 
109,
 
110,
 
111,
 
113,
 
115,
 
116,
 
117,
 
118,
 
121,
 
122,
 
123,
 
124,
 
126,
 
127,
 
128,
 
129,
 
131,
 
132,
 
133,
 
135,
 
136,
 
138,
 
139,
 
140,
 
141,
 
144,
 
145,
 
147,
 
148,
 
150,
 
151,
 
152,
 
153,
 
157,
 
158,
 
159,
 
161,
 
162,
 
166,
 
170,
 
171,
 
173,
 
174,
 
176,
 
177,
 
179,
 
180,
 
182,
 
183,
 
184,
 
185,
 
186,
 
188,
 
189,
 
190,
 
191,
 
192,
 
194,
 
197,
 
199,
 
201,
 
202,
 
205,
 
222,
 
228,
 
230,
 
231,
 
232,
 
249,
 
264,
 
272,
 
310,
 
355,
 
372,
 
373,
 
375,
 
404,
 
461,
 
472,
 
473,
 
490,
 
491,
 
531,
 
550,
 
561,
 
590,
 
649,
 
673,
 
674,
 
676,
 
679,
 
683,
 
686,
 
689,
 
691,
 
694,
 
701,
 
741,
 
754,
 
800,
 
802,
 
804,
 
805,
 
808,
 
814,
 
815,
 
821,
 
848,
 
872,
 
875,
 
876,
 
921,
 
923,
 
936,
 
953,
 
972,
 
993,
 
998,
 
1009,
 
1010,
 
1013,
 
2072,
 
5158,
 
6053)
 
DELETE 307</nowiki>
 

wikipokpokへの投稿はすべて、クリエイティブ・コモンズ 表示-継承 (詳細はWikipokpok:著作権を参照)のもとで公開したと見なされることにご注意ください。 自分が書いたものが他の人に容赦なく編集され、自由に配布されるのを望まない場合は、ここに投稿しないでください。
また、投稿するのは、自分で書いたものか、パブリック ドメインまたはそれに類するフリーな資料からの複製であることを約束してください。 著作権保護されている作品は、許諾なしに投稿しないでください!

このページを編集するには、下記の確認用の質問に回答してください (詳細):

取り消し | 編集の仕方 (新しいウィンドウで開きます)

このページで使用されているテンプレート: