Tep3

提供: wikipokpok
2022年2月23日 (水) 11:57時点におけるShudo (トーク | 投稿記録)による版 (ClientsをClientsとOthersに分ける)
移動先: 案内検索
% ruby -v
% rbenv versions
% rbenv local 2.7.5
% rails -v
% rails new tep3 -d postgresql
database.yml username
rails db:create
$ yarn add bootstrap@next
$ yarn add @popperjs/core
app/javascript/packs/application.js
import "bootstrap";
import "../stylesheets/application";
% mkdir app/javascript/stylesheets/
% touch app/javascript/stylesheets/application.scss
@import "bootstrap";
app/views/layouts/application.html.erb
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>

データベース移行

エクスポート インポート

Users

  • はじめにtepnoteのユーザーをエクスポートし tep3にインポートする

Jiins → Notes

  • tepnoteのjiinsをエクスポートし tep3のnotesにインポートする
エクスポート
\COPY (select user_id, jiin_name, kind, meeting_time, role_num, created_at, updated_at from jiins order by user_id asc) TO '/Users/jq/3tep_gomi/notes.csv' WITH CSV DELIMITER ',' FORCE QUOTE * NULL AS '' HEADER;
インポート
\COPY notes(user_id, name, kind, meeting_time, role, created_at, updated_at) FROM '/Users/jq/3tep_gomi/notes.csv' WITH CSV DELIMITER ',';
- このときjiinsのidとnotesのidを合わせる notesのuser_idは1にする(1は淨久寺グループが代々引き継ぐアカウントのユーザーID)
tep3_development=# select * from notes;
 id | user_id |        name        | kind | meeting_time | role | belong |         created_at         |         updated_at         
----+---------+--------------------+------+--------------+------+--------+----------------------------+----------------------------
  1 |       1 | 淨久寺             |      |              |    1 |        | 2019-01-30 01:12:29.847655 | 2020-02-28 18:17:08.925978
  2 |       1 | 光源寺             |      |              |    1 |        | 2019-02-01 13:04:29.292541 | 2020-02-28 18:17:45.068205
  3 |       1 | 廣國院             |      |              |    1 |        | 2019-02-01 13:04:37.908007 | 2020-08-25 14:25:08.311179
  4 |       1 | 安養寺             |      |              |    1 |        | 2019-02-01 13:04:50.543585 | 2020-02-28 18:18:04.200338
  5 |       1 | 太陽               |      |              |    1 |        | 2019-05-11 12:28:30.551584 | 2020-02-28 18:18:15.454727
  6 |       1 | 家族               |      |              |    1 |        | 2019-06-20 11:28:05.371417 | 2020-02-28 18:18:28.641819
  7 |       1 | SANデザイン事務所  |      |              |    1 |        | 2019-08-11 12:43:11.472652 | 2020-12-15 15:39:00.831541
  8 |       1 | 一般               |      |              |    1 |        | 2019-12-24 11:27:21.384603 | 2019-12-24 11:27:21.384603
  9 |       1 | 親戚               |      |              |    1 |        | 2019-12-24 13:11:43.345268 | 2019-12-24 13:11:43.345268
 10 |       1 | 光源寺護持会       |      |              |    3 |        | 2020-02-15 17:39:30.312985 | 2020-03-06 11:35:27.445689
 11 |       1 | 淨久寺護持会       |      |              |    3 |        | 2020-02-28 18:16:01.176519 | 2020-02-28 18:16:01.176519
 12 |       1 | 廣國院護持会       |      |              |    3 |        | 2020-03-02 13:18:23.289695 | 2020-03-02 13:18:23.289695
 13 |       1 | 安養寺護持会       |      |              |    3 |        | 2020-03-02 13:22:51.367168 | 2020-03-02 13:22:51.367168
 14 |       1 | 光源寺晋山結制会計 |      |              |    3 |        | 2020-03-25 11:33:09.239345 | 2020-03-25 11:33:09.239345
(14 rows)

ClientsをClientsとOthersに分ける

\COPY (select ie_id, user_id, jiin_id, created_at, updated_at from clients where nusi = true order by jiin_id asc, ie_id asc) TO '/Users/jq/3tep_gomi/clients.csv' WITH CSV DELIMITER ',' FORCE QUOTE * NULL AS '' HEADER;
\COPY (select user_id, jiin_id, ie_id, name, yomi, nusi, each_order, table_order, generation, created_at, updated_at from clients order by jiin_id asc, ie_id asc) TO '/Users/jq/3tep_gomi/others.csv' WITH CSV DELIMITER ',' FORCE QUOTE * NULL AS '' HEADER;




インポート

\COPY notes(user_id, name, kind, meeting_time, role, created_at, updated_at) FROM '/Users/jq/3tep_gomi/notes.csv' WITH CSV DELIMITER ',';
\COPY others(user_id, note_id, client_id, name, yomi, nusi, order1, order2, generation, created_at, updated_at) FROM '/Users/jq/3tep_gomi/others.csv' WITH CSV DELIMITER ',';