{"id":22128111,"url":"https://github.com/explodinglabs/sqitch-templates","last_synced_at":"2025-03-24T08:37:58.505Z","repository":{"id":130506729,"uuid":"427793495","full_name":"explodinglabs/sqitch-templates","owner":"explodinglabs","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-27T22:38:54.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T14:12:52.808Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/explodinglabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-13T23:19:52.000Z","updated_at":"2024-12-27T22:38:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"665348f2-a609-43d5-b807-acea03021085","html_url":"https://github.com/explodinglabs/sqitch-templates","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodinglabs%2Fsqitch-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodinglabs%2Fsqitch-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodinglabs%2Fsqitch-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explodinglabs%2Fsqitch-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/explodinglabs","download_url":"https://codeload.github.com/explodinglabs/sqitch-templates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245238390,"owners_count":20582865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T17:35:17.497Z","updated_at":"2025-03-24T08:37:58.481Z","avatar_url":"https://github.com/explodinglabs.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqitch-templates\n\nClone into `~/.sqitch/templates`:\n\n```sh\ngit clone https://github.com/explodinglabs/sqitch-templates ~/.sqitch/templates\n```\n\nAdd an ad-hoc change:\n\n```sh\nsqitch add [change] --note 'What it does'\n```\n\n## Schemas\n\nCreate schema:\n\n```sh\ncreate-schema [schema]\n```\n\nDrop schema (does not cascade, so drop everything in the schema first):\n\n```sh\ndrop-schema [schema]\n```\n\n## Tables\n\nCreate table (edit the table):\n\n```sh\ncreate-table [schema] [table]\n```\n\nDrop table:\n\n```sh\ndrop-table [schema] [table]\n```\n\nAdd column:\n\n```sh\nadd-column [schema] [table] [column]\n```\n\nRename column:\n\n```sh\n\n```\n\nDrop column:\n\n```sh\ndrop-column [schema] [table] [column]\n```\n\n## Roles\n\nCreate role:\n\n```sh\ncreate-role [role] nologin\n```\n\nGrant schema usage:\n\n```sh\ngrant-usage [schema] [role]\n./sqitch add grant_api_usage_to_anon --template grant_schema_usage --set schema=api --set role=anon --note 'Grant usage on api schema to anon'\n```\n\nGrant select:\n\n```sh\ngrant-select [schema] [table] [role]\n./sqitch add grant_select_api_teams --template grant_view_privileges --set type=select --set schema=api --set table=teams --set role=web_user --note 'Grant select on api.teams to web_user'\n```\n\nGrant function execute (edit the function params):\n\n```sh\n./sqitch add grant_execute_api_foo --template grant_execute --set name=api.login --set role=web_user --note 'Grant execute on api.login to web_user'\n```\n\nGrant role membership (i.e. `grant [role] to [role]`.):\n\n```sh\ngrant [role] [role]\n./sqitch add grant_role_membership_foo --template grant_role_membership --set from_role=web_user --set role=authenticator --note 'Grant web_user to authenticator'\n```\n\n## Functions\n\nCreate function:\n\n```sh\ncreate-function data playlist_updated\n```\n\nDrop function (edit the revert script to add the function back):\n\n```sh\n\n```\n\nTo edit a function, just edit the \"create function\" deploy script and sqitch\nrebase, or if the project has been deployed to another environment, do a sqitch\nrework.\n\n## Triggers\n\nCreate trigger:\n\n```sh\ncreate-trigger [schema] [table] [trigger] [function]\n```\n\nDrop trigger:\n\n```sh\n\n```\n\n## Extensions\n\n```sh\ncreate-extension [extension]\n```\n\n## Views\n\nCreate view (Then edit the select statement):\n\n```sh\n./sqitch add create_view_api_teams --template create_view --set schema=api --set name=teams --note 'Add api.teams view'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplodinglabs%2Fsqitch-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexplodinglabs%2Fsqitch-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplodinglabs%2Fsqitch-templates/lists"}