Hi Jeremy,
I know how to insert values that are taken from another table when
migrations.
Sequel.migration do
up do
create_table(:slot, ignore_index_errors: false) do
String :uuid, size: 45, null: false
String :tenant_uuid, size: 45, null: false
column :slot, 'smallint unsigned', null: false
DateTime :created_at, default: Sequel.lit('CURRENT_TIMESTAMP'), null:
false
primary_key [:uuid, :tenant_uuid]
end
from(:slot).insert([:slot, :tenant_uuid], # This won't work because of no
uuid!
from(:tenants_users).select { [count(:tenant_uuid).as(:slot),
:tenant_uuid] }.group_by(:tenant_uuid)) # I am guessing there must be a way to
append uuid around here...
end
...
end
However, what if I like to also add a new column, let's say uuid on slot
which doesn't exist on tenants_users. So I have to dynamically generate
uuids for slot table. The code above obviously not working due the reason.
I tried a bunch of ways but none of them not working so far.
Thanks, Shun
--
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 https://groups.google.com/group/sequel-talk.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/6ded2bd6-b48d-46e1-8863-e1aff23408f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.