Ravi
Ravi
Explore posts from servers
DTDrizzle Team
Created by Ravi on 7/12/2023 in #help
Custom column type with default not working?
Found the GitHub issue on this. https://github.com/drizzle-team/drizzle-orm/issues/818 Sorry that I didn't search there first..
4 replies
DTDrizzle Team
Created by Ravi on 7/12/2023 in #help
Custom column type with default not working?
I decided to say Yes to the warning to see what happens. The drizzle-kit truncated the table, but the table seems to have the correct default value.
mysql> describe MyTable;
+-----------+-----------------+------+-----+----------------------+-------------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-----------------+------+-----+----------------------+-------------------+
| id | varchar(191) | NO | PRI | NULL | |
-- ...
| usage | bigint unsigned | NO | | 0 | |
+-----------+-----------------+------+-----+----------------------+-------------------+
mysql> describe MyTable;
+-----------+-----------------+------+-----+----------------------+-------------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-----------------+------+-----+----------------------+-------------------+
| id | varchar(191) | NO | PRI | NULL | |
-- ...
| usage | bigint unsigned | NO | | 0 | |
+-----------+-----------------+------+-----+----------------------+-------------------+
Now if I add some data and run db push again (without doing any changes), it thinks the data is serial and it wants to truncate it again.
Warning Found data-loss statements:
· You're about to change usage column type from serial to bigint UNSIGNED with 3 items

THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
Warning Found data-loss statements:
· You're about to change usage column type from serial to bigint UNSIGNED with 3 items

THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
4 replies
DTDrizzle Team
Created by Ravi on 7/11/2023 in #help
good way to get the "count" for paginated queries
Thanks @Raphaël Moreau I think this is a nice way to achieve what I wanted!
3 replies