I have the following table
mysql> describe table;
+----------------+-------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+-------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| value1 | varchar(2) | NO | MUL | NULL | |
| value2 | varchar(2) | YES | | NULL | |
| value3 | varchar(10) | YES | | NULL | |
+----------------+-------------+------+-----+-------------------+----------------+
I'm trying to create an alembic rule, where value1
and value2
together create a key in the table. For example, the values
(id=1, value1="BA", value2="CN", value3="hello")
(id=2, value1="BA", value2="CN", value3="goodbye")
are the same (value1
and value2
match), but
(id=1, value1="BA", value2="CN", value3="hello")
(id=2, value1="BA", value2="US", value3="goodbye")
are not.
What would be the alembic upgrade()
and downgrade()
code for this be, using an alembic.op
object?