Skip to content

Commit 32187e0

Browse files
author
El Draper
committed
added a db task to auto migrate all core classes for feather (for initial database setup)
1 parent 8ed62ce commit 32187e0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/database.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Database
22
class << self
3-
CORE = [Activity, Article, Configuration, Plugin, User]
3+
CORE = Dir.glob("app/models/*.rb").collect { |s| Class.const_get(s.split("/").last.gsub(".rb", "").split("_").collect { |w| w.capitalize }.join("")) }
44

55
# This provides a helper method for data migration for plugins - we can then update this to use non-destructive migrations at a later date and existing plugins won't need to change
66
def migrate(klass)
@@ -11,5 +11,10 @@ def migrate(klass)
1111
# Execute auto migrations for now
1212
klass.auto_migrate!
1313
end
14+
15+
# This does the initial auto migration of all core classes
16+
def initial_setup
17+
CORE.each { |c| c.auto_migrate! }
18+
end
1419
end
1520
end

0 commit comments

Comments
 (0)