Ability to create share url slug (#4550)
* feat: share url slug * feat: add col urlId * feat: allow updating urlId * fix: typo * fix: migrations * fix: urlId model validation * fix: input label * fix: debounce slug request * feat: link preview * fix: send slug variant in response if available * fix: temporary redirect to slug variant if available * fix: move up the custom link field * fix: process and display backend err * fix: reset custom link state on popover close and remove isCopied * fix: document link preview * fix: set urlId when available * fix: keep unique(urlId, teamId) * fix: codeql * fix: get rid of preview type * fix: width not needed for block elem * fix: migrations * fix: array not required * fix: use val * fix: validation on shareId and test * fix: allow clearing urlId * fix: do not escape * fix: unique error text * fix: keep team
This commit is contained in:
43
server/migrations/20221206163421-add-share-url-slug.js
Normal file
43
server/migrations/20221206163421-add-share-url-slug.js
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
try {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await queryInterface.addColumn(
|
||||
"shares",
|
||||
"urlId",
|
||||
{
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true,
|
||||
transaction,
|
||||
},
|
||||
);
|
||||
|
||||
await queryInterface.addConstraint("shares", {
|
||||
fields: ["urlId", "teamId"],
|
||||
type: "unique",
|
||||
transaction,
|
||||
});
|
||||
});
|
||||
} catch(err) {
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
try {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await queryInterface.removeConstraint(
|
||||
"shares",
|
||||
"shares_urlId_teamId_uk",
|
||||
{ transaction }
|
||||
);
|
||||
|
||||
await queryInterface.removeColumn("shares", "urlId", { transaction });
|
||||
});
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user