{"id":15714281,"url":"https://github.com/slackapi/slack-dbmigration","last_synced_at":"2025-04-04T04:18:43.146Z","repository":{"id":62422667,"uuid":"482741694","full_name":"slackapi/slack-dbmigration","owner":"slackapi","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-18T16:25:19.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-09T15:41:51.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slackapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-18T06:36:29.000Z","updated_at":"2022-04-18T06:48:40.000Z","dependencies_parsed_at":"2022-11-01T17:31:32.722Z","dependency_job_id":null,"html_url":"https://github.com/slackapi/slack-dbmigration","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fslack-dbmigration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fslack-dbmigration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fslack-dbmigration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fslack-dbmigration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slackapi","download_url":"https://codeload.github.com/slackapi/slack-dbmigration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247117761,"owners_count":20886439,"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-10-03T21:35:49.797Z","updated_at":"2025-04-04T04:18:43.126Z","avatar_url":"https://github.com/slackapi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Slack DBMigration\n\nThis script is used to export data from Slack Tables and to migrate it over to Slack Datastores. This script was created to help beta participants trying out Slack's next generation of the platform migrate their data.\n\n## Exporting from Slack Tables\n\nThe export command writes data from a slack table into a json file. We recommend running this script from root of your slack app. This way, the script can easily grab your `appId` and `workspace` from the `apps.json` file.\n\nRun the following command. Make sure to replace `$YOUR_TABLE_NAME` with the name of your table\n\n```\ndeno run --allow-read --allow-write --allow-env --allow-net https://deno.land/x/slack_dbmigration/dbmigrate.ts export --table $YOUR_TABLE_NAME\n```\n\nYou should now have a `$YOUR_TABLE_NAMEDataBackup.json` in the root of your slack app now. You can use the import command in this script to migrate this backup into Slack Datastore\n\n### Available Options\n\n```\n--table (required)\n--appId\n--workspace - Workspace name\n```\n\n### Importing into Slack Datastores\n\nWe recommend running this script in the root of the new Slack app you have created to replace the early beta app you created. You need to add the Datastore schema to your `manifest.ts` file. The schema should mimic the table schema you used in your early beta Slack app.\n\nRun the following command. Make sure to replace `$PATH_TO_YOUR_TABLE_NAME_DataBackup.json` with the relative or full path to the table data backup `.json` file.\n\n```\ndeno run --allow-read --allow-env --allow-net https://deno.land/x/slack_dbmigration/dbmigrate.ts import --filePath=$PATH_TO_YOUR_TABLE_NAME_DataBackup.json\n```\n\n### Available Options\n\n```\n--filepath (required) - path to `.json` table backup file that was created when the `export` command was run\n--appId\n--workspace - Workspace name\n```\n\n\n## Reference\n\nOld Slack Table Schema Example\n\n```\n// in tables/reversals.ts\nexport const Reversals = DefineTable(\"reversals\", {\n  primary_key: \"id\",\n  columns: {\n    id: {\n      type: Schema.types.string,\n    },\n    original_string: {\n      type: Schema.types.string,\n    },\n    reversed_string: {\n      type: Schema.types.string,\n    },\n    channel_id: {\n      type: Schema.slack.types.channel_id,\n    },\n  },\n});\n\n// In project.ts\ntables: [Reversals],\n```\n\nNew Slack Datastore Schema Example:\n\n```\n// in manifest.ts\nconst Reversals = DefineDatastore({\n  primary_key: \"id\",\n  name: \"reversals\",\n  attributes: {\n    id: {\n      type: Schema.types.string,\n    },\n    original_string: {\n      type: Schema.types.string,\n    },\n    reversed_string: {\n      type: Schema.types.string,\n    },\n    channel_id: {\n      type: Schema.slack.types.channel_id,\n    },\n  },\n});\n\n// Add this to the manifest export in manifest.ts\ndatastores: [Reversals],\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslackapi%2Fslack-dbmigration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslackapi%2Fslack-dbmigration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslackapi%2Fslack-dbmigration/lists"}