First of All,  here is an hash

data[:posts] = {
    :pid => {
        :primary_key => true
    },
    :title => {
        :type => 'String'
    },
    :body => {
        :type => 'Text'
    },
}

Assuming a method called `data_to_migration`, i put the data to it like 
`data_to_migration(data)`, so it will generate the migration file as below, 
after, i implement the migration to affect the database

Sequel.migration do
    change do
        create_table(:posts) do
            primary_key :pid
            String :title
            Text :body
        end
    end
end


Later, i remember something and intend to change the schema of database by 
modifying that hash, the modified result as below

data[:posts] = {
    :pid => {
        :primary_key => true
    },
    :title => {
        :type => 'String'
    },
    :body => {
        :type => 'Text'
    },
    :created => {
        :type => 'Time'
    },
}

and that still will generate a new migration file like

Sequel.migration do
     change do
         alter_table(:posts) do
              add_column :created, Time
         end
     end
end

So, the method `data_to_migration(data)` that responsibility is to generate 
the migration content according to an hash variable that will be modified 
again and again as i want to,

Currently, is the Sequel has a method like `data_to_migration` existing to 
implement the function of what i need ?

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to