go-gorp / gorp

Go Relational Persistence - an ORM-ish library for Go
MIT License
3.74k stars 369 forks source link

CreateTablesIfNotExists() generates an error when using sql server driver #450

Open esetnik opened 9 months ago

esetnik commented 9 months ago

Error: Could not create constraint or index. See previous errors.

The TSQL does not support CREATE TABLE IF NOT EXISTS syntax so a workaround needs to be implemented in the sqlserver driver.

https://database.guide/create-a-table-if-it-doesnt-exist-in-sql/