· 8 years ago · Apr 13, 2018, 11:08 PM
1## Create the database
2
3CREATE DATABASE small_development;
4
5## Some schema
6
7DROP TABLE IF EXISTS `complex_obs`;
8CREATE TABLE `complex_obs` (
9 `obs_id` int(11) NOT NULL default '0',
10 PRIMARY KEY (`obs_id`)
11) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12
13DROP TABLE IF EXISTS `concept_word`;
14CREATE TABLE `concept_word` (
15 `concept_id` int(11) NOT NULL default '0',
16 `word` varchar(50) NOT NULL default '',
17 `synonym` varchar(255) NOT NULL default '',
18 `locale` varchar(20) NOT NULL default '',
19 PRIMARY KEY (`concept_id`,`word`,`synonym`,`locale`)
20) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
22## Load that schema
23
24mysql -u root small_development < schema_small.sql
25
26## Dump the schema
27
28rake db:schema:dump
29
30## Results
31
32# This file is autogenerated. Instead of editing this file, please use the
33# migrations feature of ActiveRecord to incrementally modify your database, and
34# then regenerate this schema definition.
35
36ActiveRecord::Schema.define() do
37
38 create_table "complex_obs", :id => false, :force => true do |t|
39 t.column "obs_id", :integer, :default => 0, :null => false
40 end
41
42 create_table "concept_word", :id => false, :force => true do |t|
43 t.column "concept_id", :integer, :default => 0, :null => false
44 t.column "word", :string, :limit => 50, :default => "", :null => false
45 t.column "synonym", :string, :default => "", :null => false
46 t.column "locale", :string, :limit => 20, :default => "", :null => false
47 end
48
49end