<feed xmlns='http://www.w3.org/2005/Atom'>
<title>cashier/server/store/migrations/sqlite3, branch master</title>
<subtitle>Mirror of Cashier, a SSH Certificate Authority (CA).
</subtitle>
<link rel='alternate' type='text/html' href='https://git.benburwell.com/mirrors/cashier/'/>
<entry>
<title>Simplify</title>
<updated>2020-04-14T03:57:13+00:00</updated>
<author>
<name>Ben Burwell</name>
<email>ben@benburwell.com</email>
</author>
<published>2020-04-14T03:57:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.benburwell.com/mirrors/cashier/commit/?id=2ce3b86e0ff69538935db3149d1ed2f24aea09a3'/>
<id>2ce3b86e0ff69538935db3149d1ed2f24aea09a3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Record request reason in the db instead of logging</title>
<updated>2018-08-23T21:29:46+00:00</updated>
<author>
<name>Niall Sheridan</name>
<email>nsheridan@gmail.com</email>
</author>
<published>2018-08-23T21:29:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.benburwell.com/mirrors/cashier/commit/?id=eb1184b284ea37cc31556e3598916ac9c3fa6939'/>
<id>eb1184b284ea37cc31556e3598916ac9c3fa6939</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Change the primary key on the issued_certs table</title>
<updated>2018-08-07T23:12:49+00:00</updated>
<author>
<name>Niall Sheridan</name>
<email>nsheridan@gmail.com</email>
</author>
<published>2018-08-07T22:43:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.benburwell.com/mirrors/cashier/commit/?id=60d005f8d174d21162cab2b029f74cfe2925acab'/>
<id>60d005f8d174d21162cab2b029f74cfe2925acab</id>
<content type='text'>
In retrospect a primary key that has no relation to the certificate is preferred to using the certificate KeyID. The KeyID is also very large for a primary index.
This is a moderately tricky migration, especially for SQLite which has no means of altering the table in this fashion - it involves creating the new table and copying the data.
Order of commands also matters - index names are global in SQLite, so the `idx_expires_at` index needs to be created at the correct stages.

For MySQL migration the necessary steps are run as a single alter statement to minimise the risk of leaving the migration in an incomplete state if anything aborts.

When tested on a table with 250,000 rows (MySQL 5.7) the migration took 3 seconds to complete. As certificates will be requested infrequently the risk of prolonged locking is minimal.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In retrospect a primary key that has no relation to the certificate is preferred to using the certificate KeyID. The KeyID is also very large for a primary index.
This is a moderately tricky migration, especially for SQLite which has no means of altering the table in this fashion - it involves creating the new table and copying the data.
Order of commands also matters - index names are global in SQLite, so the `idx_expires_at` index needs to be created at the correct stages.

For MySQL migration the necessary steps are run as a single alter statement to minimise the risk of leaving the migration in an incomplete state if anything aborts.

When tested on a table with 250,000 rows (MySQL 5.7) the migration took 3 seconds to complete. As certificates will be requested infrequently the risk of prolonged locking is minimal.
</pre>
</div>
</content>
</entry>
<entry>
<title>Drop unneeded index idx_revoked_expires_at</title>
<updated>2018-08-07T22:55:40+00:00</updated>
<author>
<name>Niall Sheridan</name>
<email>nsheridan@gmail.com</email>
</author>
<published>2018-08-07T15:15:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.benburwell.com/mirrors/cashier/commit/?id=30c64cb3292f55231bc20c365c2fe5d06d6d2369'/>
<id>30c64cb3292f55231bc20c365c2fe5d06d6d2369</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Manage db schema with rubenv/sql-migrate</title>
<updated>2018-08-07T14:43:39+00:00</updated>
<author>
<name>Niall Sheridan</name>
<email>nsheridan@gmail.com</email>
</author>
<published>2018-08-05T22:00:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.benburwell.com/mirrors/cashier/commit/?id=d836a4496de7b24a9d3317e274800d35053a04f6'/>
<id>d836a4496de7b24a9d3317e274800d35053a04f6</id>
<content type='text'>
It's currently hard to make changes to the database schema. Use sql-migrate to make incremental changes.
Stop hard-coding the database name (the default is still "certs" for backward-compatibility)
The `automigrate()` function will automatically run pending migrations.
Use a different migration directory per database driver. This carries a cost of duplication, but is easier than creating migrations which will cleanly execute in both SQLite and MySQL.
Migrations are shipped using the packr utility.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's currently hard to make changes to the database schema. Use sql-migrate to make incremental changes.
Stop hard-coding the database name (the default is still "certs" for backward-compatibility)
The `automigrate()` function will automatically run pending migrations.
Use a different migration directory per database driver. This carries a cost of duplication, but is easier than creating migrations which will cleanly execute in both SQLite and MySQL.
Migrations are shipped using the packr utility.
</pre>
</div>
</content>
</entry>
</feed>
