<p>When applying <code>is_auto_increment</code> for already existing field</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-md">--- a/lib/HyperMouse/Schema/Result/Language.pm</span>
<span class="pl-mi1">+++ b/lib/HyperMouse/Schema/Result/Language.pm</span>
<span class="pl-mdr">@@ -33,6 +33,7 @@</span> $Z-&gt;add_columns(
   },
   language_id =&gt; {
     data_type =&gt; "integer",
<span class="pl-mi1"><span class="pl-mi1">+</span>    is_auto_increment =&gt; 1,</span>
     extra =&gt; { unsigned =&gt; 1 },
   },
     known_from =&gt; {</pre></div><div class="js-accept-changes" style="margin-top: -16px;"></div>
<p>the generated upgrade script is:</p>
<pre><code>ALTER TABLE language ALTER COLUMN language_id TYPE serial;
</code></pre>
<p>which fails with error <code>ERROR: type "serial" does not exist at</code>:</p>
<pre><code>$(which dbic-migration) --schema_class HyperMouse::Schema --database PostgreSQL -Ilib upgrade
Reading configurations from /home/kes/work/projects/tucha/monkeyman/share/fixtures/13/conf
failed to run SQL in /home/kes/work/projects/tucha/monkeyman/share/migrations/PostgreSQL/upgrade/13-14/001-auto.sql: DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::try {...} (): DBI Exception: DBD::Pg::db do failed: ERROR:  type "serial" does not exist at inline delegation in DBIx::Class::DeploymentHandler for deploy_method-&gt;upgrade_single_step (attribute declared in /home/kes/work/projects/tucha/monkeyman/local/lib/perl5/DBIx/Class/DeploymentHandler/WithApplicatorDumple.pm at line 51) line 18
 (running line 'ALTER TABLE language ALTER COLUMN language_id TYPE serial') at /home/kes/work/projects/tucha/monkeyman/local/lib/perl5/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 248.
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /home/kes/work/projects/tucha/monkeyman/local/bin/dbic-migration line 0
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /home/kes/work/projects/tucha/monkeyman/local/bin/dbic-migration line 0
Makefile:132: recipe for target 'dbup' failed
make: *** [dbup] Error 255
</code></pre>
<p>For already existing field there should be few commands:</p>
<pre><code>CREATE SEQUENCE foo_a_seq OWNED BY foo.a;
SELECT setval('foo_a_seq', coalesce(max(a), 0)) FROM foo;
ALTER TABLE foo ALTER COLUMN a SET DEFAULT nextval('foo_a_seq'); 
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/dbsrgits/sql-translator/issues/107">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AASeAl9F7jSOF7X5q3dOmA1ewQCWSHYjks5uGfIugaJpZM4VP24j">mute the thread</a>.<img src="https://github.com/notifications/beacon/AASeAi03D9C0HsrBlDg8h3hfCflopg5Eks5uGfIugaJpZM4VP24j.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/dbsrgits/sql-translator","title":"dbsrgits/sql-translator","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/dbsrgits/sql-translator"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"apply `is_auto_increment` for already existing field (#107)"}],"action":{"name":"View Issue","url":"https://github.com/dbsrgits/sql-translator/issues/107"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/dbsrgits/sql-translator/issues/107",
"url": "https://github.com/dbsrgits/sql-translator/issues/107",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "apply `is_auto_increment` for already existing field (#107)",
"sections": [
{
"text": "",
"activityTitle": "**Eugen Konkov**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@KES777",
"facts": [
{
"name": "Repository: ",
"value": "dbsrgits/sql-translator"
},
{
"name": "Issue #: ",
"value": 107
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"dbsrgits/sql-translator\",\n\"issueId\": 107,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"dbsrgits/sql-translator\",\n\"issueId\": 107\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/dbsrgits/sql-translator/issues/107"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 356478499\n}"
}
],
"themeColor": "26292E"
}
]</script>