{"id":13895750,"url":"https://github.com/leafo/lapis-annotate","last_synced_at":"2025-05-12T20:25:26.939Z","repository":{"id":47730012,"uuid":"45289025","full_name":"leafo/lapis-annotate","owner":"leafo","description":"Annotate lapis models with their schema from the database","archived":false,"fork":false,"pushed_at":"2024-05-21T19:24:13.000Z","size":20,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-12T20:25:09.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/leafo.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":"2015-10-31T04:42:02.000Z","updated_at":"2024-03-28T18:11:39.000Z","dependencies_parsed_at":"2024-06-19T20:06:08.099Z","dependency_job_id":"b28f498c-7e5b-40c9-8eb4-a2863b51e545","html_url":"https://github.com/leafo/lapis-annotate","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-annotate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-annotate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-annotate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-annotate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafo","download_url":"https://codeload.github.com/leafo/lapis-annotate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253815207,"owners_count":21968590,"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-08-06T18:02:26.739Z","updated_at":"2025-05-12T20:25:26.880Z","avatar_url":"https://github.com/leafo.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# lapis-annotate\n\n`lapis-annotate` is a [Lapis](http://leafo.net/lapis) extension that lets you\nannotate your model files with their schema.\n\n\n## Install\n\n```\n$ luarocks install lapis-annotate\n```\n\n## Usage\n\n```\n$ lapis annotate help\nUsage: lapis annotate [-h] [--preload-module \u003cname\u003e]\n       [--format {sql,table,generate_enum_comments}] [--print]\n       \u003cfiles\u003e [\u003cfiles\u003e] ...\n\nExtract schema information from model's table to comment model\n\nArguments:\n   files                 Paths to model classes to annotate (eg. models/first.moon models/second.moon ...)\n\nOptions:\n   -h, --help            Show this help message and exit.\n   --preload-module \u003cname\u003e\n                         Module to require before annotating a model\n   --format {sql,table,generate_enum_comments}\n                         What dump format to use (default: sql)\n   --print, -p           Print the output instead of editing the model files\n\n```\n\nExample annotating a single model:\n\n\n```\n$ lapis annotate models/my_model.moon\n```\n\nBefore: \n\n```moon\nimport Model from require \"lapis.db.model\"\n\nclass UserIpAddresses extends Model\n  @timestamp: true\n  @primary_key: {\"user_id\", \"ip\"}\n```\n\nAfter:\n\n\n```moon\nimport Model from require \"lapis.db.model\"\n\n-- Generated schema dump: (do not edit)\n--\n-- CREATE TABLE user_ip_addresses (\n--   user_id integer NOT NULL,\n--   ip character varying(255) NOT NULL,\n--   created_at timestamp without time zone NOT NULL,\n--   updated_at timestamp without time zone NOT NULL\n-- );\n-- ALTER TABLE ONLY user_ip_addresses\n--   ADD CONSTRAINT user_ip_addresses_pkey PRIMARY KEY (user_id, ip);\n-- CREATE INDEX user_ip_addresses_ip_idx ON user_ip_addresses USING btree (ip);\n--\nclass UserIpAddresses extends Model\n  @timestamp: true\n  @primary_key: {\"user_id\", \"ip\"}\n\n\n```\n\n## Arguments\n\n* `--preload-module=MODULE_NAME`: load the named module with `require` before initializing config\n\n## Notes\n\nOnly supports MoonScript and PostgreSQL at the moment\n\n## Changes\n\n* **2021-03-15** `1.2.1` Don't include the default `public` table shema in output\n* **2018-04-03** `1.2.0` Strip any `SELECT` lines from the output\n* **2017-06-14** `1.1.0` Add support for db user/password (Skiouros), add shell escaping\n* **2016-01-23** `1.0.0` Initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Flapis-annotate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafo%2Flapis-annotate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Flapis-annotate/lists"}