Yeah, came across that just a moment ago. I’m going to give it a go by hand and see. I hate that different databases have slight tweaks to the structure. I thought that was what something like sqlalchemy was suppose to work around.
Of course, when you just execute a sql statement directly, nothing sqlalchemy can do. Maybe there is another way to use the tool to generate schema changes?
Edit: This is what I did. So far, so good. I spun up a new database and instance of HA and let it create the database, then ran a schema compare against them and things look good.
Edit 2: I first created the new columns as CHARACTER (which is what the code says) but to match the newly created database, they need to be VARCHAR. Updated below:
ALTER TABLE events ADD context_id VARCHAR(36)
ALTER TABLE events ADD context_user_id VARCHAR(36)
CREATE NONCLUSTERED INDEX [ix_events_context_id] ON [dbo].[events] ([context_id] ASC )
CREATE NONCLUSTERED INDEX [ix_events_context_user_id] ON [dbo].[events] ([context_user_id] ASC )
ALTER TABLE states ADD context_id VARCHAR(36)
ALTER TABLE states ADD context_user_id VARCHAR(36)
CREATE NONCLUSTERED INDEX [ix_events_context_id] ON [dbo].[states] ([context_id] ASC )
CREATE NONCLUSTERED INDEX [ix_events_context_user_id] ON [dbo].[states] ([context_user_id] ASC )
INSERT INTO [dbo].[schema_changes](schema_version, changed) VALUES(6, SELECT GETUTCDATE())