arel-helpers 2.11.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,44 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'env/migrations'
4
- require 'env/models'
5
-
6
- module ArelHelpers
7
- class Env
8
- class << self
9
-
10
- def db_dir
11
- @db_dir ||= File.join(File.dirname(File.dirname(__FILE__)), "tmp")
12
- end
13
-
14
- def db_file
15
- @db_file ||= File.join(db_dir, "test.sqlite3")
16
- end
17
-
18
- def establish_connection
19
- ActiveRecord::Base.establish_connection(
20
- :adapter => "sqlite3",
21
- :database => db_file
22
- )
23
- end
24
-
25
- def migrate
26
- CreatePostsTable.new.change
27
- CreateCommentsTable.new.change
28
- CreateAuthorsTable.new.change
29
- CreateFavoritesTable.new.change
30
- CreateCollabPostsTable.new.change
31
- CreateCardsTable.new.change
32
- CreateCardLocationsTable.new.change
33
- CreateLocationsTable.new.change
34
- CreateCommunityTicketsTable.new.change
35
- end
36
-
37
- def reset
38
- File.unlink(db_file) if File.exist?(db_file)
39
- FileUtils.mkdir_p(db_dir)
40
- end
41
-
42
- end
43
- end
44
- end
@@ -1,75 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- SuperClass = if ActiveRecord::VERSION::MAJOR >= 5
4
- ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}".to_f]
5
- else
6
- ActiveRecord::Migration
7
- end
8
-
9
- class CreatePostsTable < SuperClass
10
- def change
11
- create_table :posts do |t|
12
- t.column :title, :string
13
- end
14
- end
15
- end
16
-
17
- class CreateCommentsTable < SuperClass
18
- def change
19
- create_table :comments do |t|
20
- t.references :post
21
- end
22
- end
23
- end
24
-
25
- class CreateAuthorsTable < SuperClass
26
- def change
27
- create_table :authors do |t|
28
- t.references :comment
29
- t.references :collab_posts
30
- end
31
- end
32
- end
33
-
34
- class CreateFavoritesTable < SuperClass
35
- def change
36
- create_table :favorites do |t|
37
- t.references :post
38
- end
39
- end
40
- end
41
-
42
- class CreateCollabPostsTable < SuperClass
43
- def change
44
- create_table :collab_posts do |t|
45
- t.references :authors
46
- end
47
- end
48
- end
49
-
50
- class CreateCardsTable < SuperClass
51
- def change
52
- create_table :cards
53
- end
54
- end
55
-
56
- class CreateCardLocationsTable < SuperClass
57
- def change
58
- create_table :card_locations do |t|
59
- t.references :location
60
- t.references :card, polymorphic: true
61
- end
62
- end
63
- end
64
-
65
- class CreateLocationsTable < SuperClass
66
- def change
67
- create_table :locations
68
- end
69
- end
70
-
71
- class CreateCommunityTicketsTable < SuperClass
72
- def change
73
- create_table :community_tickets
74
- end
75
- end