Browse Source

CPassage de sqlite3 à pgsql 12

Lou 3 years ago
parent
commit
a79c4d4127
4 changed files with 23 additions and 12 deletions
  1. 5
    1
      Gemfile
  2. 2
    2
      Gemfile.lock
  3. 8
    4
      config/database.yml
  4. 8
    5
      db/schema.rb

+ 5
- 1
Gemfile View File

6
 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
6
 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
7
 gem 'rails', '~> 6.1.3', '>= 6.1.3.1'
7
 gem 'rails', '~> 6.1.3', '>= 6.1.3.1'
8
 # Use sqlite3 as the database for Active Record
8
 # Use sqlite3 as the database for Active Record
9
-gem 'sqlite3', '~> 1.4'
9
+# gem 'sqlite3', '~> 1.4'
10
+
11
+# Use PostgreSQL as the database for Active Record
12
+gem 'pg'
13
+
10
 # Use Puma as the app server
14
 # Use Puma as the app server
11
 gem 'puma', '~> 5.0'
15
 gem 'puma', '~> 5.0'
12
 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
16
 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

+ 2
- 2
Gemfile.lock View File

96
     nio4r (2.5.7)
96
     nio4r (2.5.7)
97
     nokogiri (1.11.3-x86_64-linux)
97
     nokogiri (1.11.3-x86_64-linux)
98
       racc (~> 1.4)
98
       racc (~> 1.4)
99
+    pg (1.2.3)
99
     puma (5.2.2)
100
     puma (5.2.2)
100
       nio4r (~> 2.0)
101
       nio4r (~> 2.0)
101
     racc (1.5.2)
102
     racc (1.5.2)
150
       actionpack (>= 4.0)
151
       actionpack (>= 4.0)
151
       activesupport (>= 4.0)
152
       activesupport (>= 4.0)
152
       sprockets (>= 3.0.0)
153
       sprockets (>= 3.0.0)
153
-    sqlite3 (1.4.2)
154
     table_print (1.5.7)
154
     table_print (1.5.7)
155
     thor (1.1.0)
155
     thor (1.1.0)
156
     tzinfo (2.0.4)
156
     tzinfo (2.0.4)
172
   jsonapi-serializer (~> 2.2)
172
   jsonapi-serializer (~> 2.2)
173
   jwt (~> 2.2)
173
   jwt (~> 2.2)
174
   listen (~> 3.3)
174
   listen (~> 3.3)
175
+  pg
175
   puma (~> 5.0)
176
   puma (~> 5.0)
176
   rack-cors
177
   rack-cors
177
   rails (~> 6.1.3, >= 6.1.3.1)
178
   rails (~> 6.1.3, >= 6.1.3.1)
178
   rails-erd
179
   rails-erd
179
   spring
180
   spring
180
-  sqlite3 (~> 1.4)
181
   table_print (~> 1.5)
181
   table_print (~> 1.5)
182
   tzinfo-data
182
   tzinfo-data
183
 
183
 

+ 8
- 4
config/database.yml View File

5
 #   gem 'sqlite3'
5
 #   gem 'sqlite3'
6
 #
6
 #
7
 default: &default
7
 default: &default
8
-  adapter: sqlite3
8
+  # adapter: sqlite3
9
+  adapter: postgresql
9
   pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
   pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
   timeout: 5000
11
   timeout: 5000
11
 
12
 
12
 development:
13
 development:
13
   <<: *default
14
   <<: *default
14
-  database: db/development.sqlite3
15
+  # database: db/development.sqlite3
16
+  database: registra_development
15
 
17
 
16
 # Warning: The database defined as "test" will be erased and
18
 # Warning: The database defined as "test" will be erased and
17
 # re-generated from your development database when you run "rake".
19
 # re-generated from your development database when you run "rake".
18
 # Do not set this db to the same as development or production.
20
 # Do not set this db to the same as development or production.
19
 test:
21
 test:
20
   <<: *default
22
   <<: *default
21
-  database: db/test.sqlite3
23
+  # database: db/test.sqlite3
24
+  database: registra_test
22
 
25
 
23
 production:
26
 production:
24
   <<: *default
27
   <<: *default
25
-  database: db/production.sqlite3
28
+  # database: db/production.sqlite3
29
+  database: registra_production

+ 8
- 5
db/schema.rb View File

12
 
12
 
13
 ActiveRecord::Schema.define(version: 2021_05_10_133939) do
13
 ActiveRecord::Schema.define(version: 2021_05_10_133939) do
14
 
14
 
15
+  # These are extensions that must be enabled in order to support this database
16
+  enable_extension "plpgsql"
17
+
15
   create_table "activities", force: :cascade do |t|
18
   create_table "activities", force: :cascade do |t|
16
     t.string "name", null: false
19
     t.string "name", null: false
17
     t.string "client"
20
     t.string "client"
18
     t.string "description"
21
     t.string "description"
19
-    t.integer "author_id", null: false
22
+    t.bigint "author_id", null: false
20
     t.datetime "created_at", precision: 6, null: false
23
     t.datetime "created_at", precision: 6, null: false
21
     t.datetime "updated_at", precision: 6, null: false
24
     t.datetime "updated_at", precision: 6, null: false
22
     t.index ["author_id"], name: "index_activities_on_author_id"
25
     t.index ["author_id"], name: "index_activities_on_author_id"
24
   end
27
   end
25
 
28
 
26
   create_table "joined_user_activities", force: :cascade do |t|
29
   create_table "joined_user_activities", force: :cascade do |t|
27
-    t.integer "user_id"
28
-    t.integer "activity_id"
30
+    t.bigint "user_id"
31
+    t.bigint "activity_id"
29
     t.datetime "created_at", precision: 6, null: false
32
     t.datetime "created_at", precision: 6, null: false
30
     t.datetime "updated_at", precision: 6, null: false
33
     t.datetime "updated_at", precision: 6, null: false
31
     t.index ["activity_id"], name: "index_joined_user_activities_on_activity_id"
34
     t.index ["activity_id"], name: "index_joined_user_activities_on_activity_id"
36
     t.string "name", null: false
39
     t.string "name", null: false
37
     t.text "description"
40
     t.text "description"
38
     t.integer "duration"
41
     t.integer "duration"
39
-    t.integer "activity_id", null: false
40
-    t.integer "user_id", null: false
42
+    t.bigint "activity_id", null: false
43
+    t.bigint "user_id", null: false
41
     t.datetime "created_at", precision: 6, null: false
44
     t.datetime "created_at", precision: 6, null: false
42
     t.datetime "updated_at", precision: 6, null: false
45
     t.datetime "updated_at", precision: 6, null: false
43
     t.index ["activity_id"], name: "index_tasks_on_activity_id"
46
     t.index ["activity_id"], name: "index_tasks_on_activity_id"

Loading…
Cancel
Save