OSDN Git Service

add db/groonga/migrate and schema
authornomeu <nomeu@users.sourceforge.jp>
Thu, 7 Jul 2011 05:10:40 +0000 (14:10 +0900)
committernomeu <nomeu@users.sourceforge.jp>
Thu, 7 Jul 2011 05:10:40 +0000 (14:10 +0900)
.gitignore
db/groonga/migrate/20110706191126_create_sites.rb [new file with mode: 0644]
db/groonga/migrate/20110707014259_create_thumbs.rb [new file with mode: 0644]
db/groonga/migrate/20110707015921_create_arcs.rb [new file with mode: 0644]
db/groonga/migrate/20110707033248_create_pmds.rb [new file with mode: 0644]
db/groonga/migrate/20110707034654_create_vmds.rb [new file with mode: 0644]
db/groonga/migrate/20110707050534_create_xes.rb [new file with mode: 0644]
db/groonga/schema.rb [new file with mode: 0644]

index e87d615..a9141ed 100644 (file)
@@ -1,5 +1,6 @@
 .bundle
 db/*.sqlite3
-db/groonga/
+db/groonga/development/
+db/groonga/test/
 log/*.log
 tmp/
diff --git a/db/groonga/migrate/20110706191126_create_sites.rb b/db/groonga/migrate/20110706191126_create_sites.rb
new file mode 100644 (file)
index 0000000..2b2fbf7
--- /dev/null
@@ -0,0 +1,13 @@
+class CreateSites < ActiveGroonga::Migration
+  def up
+    create_table(:sites, :type => :hash, :key_type => 'ShortText') do |table|
+      table.short_text(:url)
+      table.short_text(:summary)
+      table.timestamps
+    end
+  end
+
+  def down
+    remove_table(:sites)
+  end
+end
diff --git a/db/groonga/migrate/20110707014259_create_thumbs.rb b/db/groonga/migrate/20110707014259_create_thumbs.rb
new file mode 100644 (file)
index 0000000..31cdb66
--- /dev/null
@@ -0,0 +1,13 @@
+class CreateThumbs < ActiveGroonga::Migration
+  def up
+    create_table(:thumbs, :type => :hash, :key_type => 'ShortText') do |table|
+      table.short_text(:title)
+      table.short_text(:description)
+      table.timestamps
+    end
+  end
+
+  def down
+    remove_table(:thumbs)
+  end
+end
diff --git a/db/groonga/migrate/20110707015921_create_arcs.rb b/db/groonga/migrate/20110707015921_create_arcs.rb
new file mode 100644 (file)
index 0000000..7bf07f8
--- /dev/null
@@ -0,0 +1,16 @@
+class CreateArcs < ActiveGroonga::Migration
+  def up
+    create_table(:arcs, :type => :hash, :key_type => 'ShortText') do |table|
+      table.short_text(:extname)
+      table.reference(:site)
+      table.short_text(:summary)
+      table.short_text(:origname)
+      table.boolean(:locked)
+      table.timestamps
+    end
+  end
+
+  def down
+    remove_table(:arcs)
+  end
+end
diff --git a/db/groonga/migrate/20110707033248_create_pmds.rb b/db/groonga/migrate/20110707033248_create_pmds.rb
new file mode 100644 (file)
index 0000000..d3728e5
--- /dev/null
@@ -0,0 +1,13 @@
+class CreatePmds < ActiveGroonga::Migration
+  def up
+    create_table(:pmds) do |table|
+      table.reference(:arc)
+      table.short_text(:path)
+      table.timestamps
+    end
+  end
+
+  def down
+    remove_table(:pmds)
+  end
+end
diff --git a/db/groonga/migrate/20110707034654_create_vmds.rb b/db/groonga/migrate/20110707034654_create_vmds.rb
new file mode 100644 (file)
index 0000000..1e42dba
--- /dev/null
@@ -0,0 +1,13 @@
+class CreateVmds < ActiveGroonga::Migration
+  def up
+    create_table(:vmds) do |table|
+      table.reference(:arc)
+      table.short_text(:path)
+      table.timestamps
+    end
+  end
+
+  def down
+    remove_table(:vmds)
+  end
+end
diff --git a/db/groonga/migrate/20110707050534_create_xes.rb b/db/groonga/migrate/20110707050534_create_xes.rb
new file mode 100644 (file)
index 0000000..e49253b
--- /dev/null
@@ -0,0 +1,13 @@
+class CreateXes < ActiveGroonga::Migration
+  def up
+    create_table(:xes) do |table|
+      table.reference(:arc)
+      table.short_text(:path)
+      table.timestamps
+    end
+  end
+
+  def down
+    remove_table(:xes)
+  end
+end
diff --git a/db/groonga/schema.rb b/db/groonga/schema.rb
new file mode 100644 (file)
index 0000000..de7c94e
--- /dev/null
@@ -0,0 +1,79 @@
+ActiveGroonga::Schema.define(:version => 20110707050534) do |schema|
+  schema.instance_eval do
+    create_table("arcs",
+                 :type => :hash,
+                 :key_type => "ShortText",
+                 :force => true) do |table|
+      table.time("created_at")
+      table.short_text("extname")
+      table.boolean("locked")
+      table.short_text("origname")
+      table.short_text("summary")
+      table.time("updated_at")
+    end
+
+    create_table("pmds",
+                 :force => true) do |table|
+      table.time("created_at")
+      table.short_text("path")
+      table.time("updated_at")
+    end
+
+    create_table("schema_migrations",
+                 :type => :hash,
+                 :key_type => "UInt64",
+                 :force => true) do |table|
+      table.time("migrated_at")
+    end
+
+    create_table("sites",
+                 :type => :hash,
+                 :key_type => "ShortText",
+                 :force => true) do |table|
+      table.time("created_at")
+      table.short_text("summary")
+      table.time("updated_at")
+      table.short_text("url")
+    end
+
+    create_table("thumbs",
+                 :type => :hash,
+                 :key_type => "ShortText",
+                 :force => true) do |table|
+      table.time("created_at")
+      table.short_text("description")
+      table.short_text("title")
+      table.time("updated_at")
+    end
+
+    create_table("vmds",
+                 :force => true) do |table|
+      table.time("created_at")
+      table.short_text("path")
+      table.time("updated_at")
+    end
+
+    create_table("xes",
+                 :force => true) do |table|
+      table.time("created_at")
+      table.short_text("path")
+      table.time("updated_at")
+    end
+
+    change_table("arcs") do |table|
+      table.reference("site", "sites")
+    end
+
+    change_table("pmds") do |table|
+      table.reference("arc", "arcs")
+    end
+
+    change_table("vmds") do |table|
+      table.reference("arc", "arcs")
+    end
+
+    change_table("xes") do |table|
+      table.reference("arc", "arcs")
+    end
+  end
+end