1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
Commit Graph

219 Commits

Author SHA1 Message Date
Gastón Fournier
cee2500a4d
feat(2-1879): add enabled to action sets (#6023)
## About the changes
Adds enabled to action sets table
2024-01-24 12:52:04 +01:00
Gastón Fournier
8ba5cdced1
feat: add action states (#5983)
## About the changes
Add action states table without an index yet
2024-01-22 11:49:35 +01:00
Jaanus Sellin
605125fbb5
feat: add primary keys to missing tables (#5943)
Follow up of https://github.com/Unleash/unleash/issues/4303

We are adding primary keys to all tables missing them, currently
**role_permission**, **api_token_project**, and **project_stats**.
By adding primary keys, the issue with migrations failing during
upgrades in replicated database setups will be resolved.
2024-01-18 13:52:51 +02:00
Christopher Kolstad
fa72ced1e5
feat: added more granular project permissions (#5932)
### What
Adds Read and Write permissions for project administration settings
(user access, change request settings, default strategy, other).

### Why
On request from two large customers that wanted our RBAC controls to be
more granulated to easier be able to limit the access they granted their
users.
2024-01-18 09:57:44 +01:00
Gastón Fournier
04e55831e3
chore: add another system user for admin tokens (#5915)
## About the changes
This admin token user will help us differentiate actions performed by
the system from actions performed with an admin token.

Events created with an admin token should have the id of this user as
createdByUserId property and the username of the token used as the
createdBy property. i.e.
```json
{
  "id": 11,
  "type": "pat-created",
  "createdBy": "admin-token",
  "createdAt": "2024-01-16T13:16:27.887Z",
  "createdByUserId": -42,
  "data": {
    "description": "admin-pat",
    "expiresAt": "2024-02-15T13:16:25.586Z",
    "secret": "***",
    "userId": 1
  },
  "preData": null,
  "tags": [],
  "featureName": null,
  "project": null,
  "environment": null
}
```
2024-01-16 19:28:36 +01:00
Nuno Góis
aeb9c85f11
chore: delete unnecessary column permission_id (#5413)
Follows up on https://github.com/Unleash/unleash/pull/5409 and drops
this column, since it's no longer used.
See: https://github.com/Unleash/unleash/pull/5409#discussion_r1404112310

Should only be merged after ~~`5.7`~~ `5.8` has been released.
2024-01-16 10:56:22 +00:00
Thomas Heartman
4564c97927
chore: remove system user's email in db. (#5849)
Updates it from 'system@getunleash.io' to `null`. We don't have that
address registered (and probably don't want it), so we'll leave it
empty.

This is a companion PR to
https://github.com/Unleash/unleash/pull/5893. With both of those
merged, the system user in the DB should match the one defined in
`core.ts`
2024-01-16 11:15:29 +05:30
Gastón Fournier
79d438ac46
feat: add automated actions tables (#5857)
Add tables to support automated actions based on the [design
document](https://docs.google.com/document/d/15xPgn6B8gzMPk9RjMAUGu8XvozQ_45jjrsVl_Bm6Chg/edit?usp=sharinghttps://docs.google.com/document/d/15xPgn6B8gzMPk9RjMAUGu8XvozQ_45jjrsVl_Bm6Chg/edit?usp=sharing)
2024-01-11 14:42:37 +01:00
Thomas Heartman
e8ffea3920
chore: add reason column to change request schedule table (#5802)
This PR adds a new `reason` column to the change request schedules table
and populates it with the data that is in the `failure_reason` column.

This is the expand phase of the expand/contract pattern. The code in
enterprise will be updated to try and use the new column name, but fall
back to the old one if no value is present.

The old column can be removed later.
2024-01-10 08:47:30 +05:30
Mateusz Kwasniewski
99b165741d
feat: daily metrics db migration (#5791) 2024-01-09 11:56:12 +01:00
Nuno Góis
24b4e8dcb2
chore: incoming webhooks description migration (#5803)
https://linear.app/unleash/issue/2-1822/incoming-webhooks-add-description

A description field will help us better distinguish incoming webhooks
and their purpose.
2024-01-09 10:39:51 +00:00
Nuno Góis
9c4a044543
chore: observable events db migration (#5749)
https://linear.app/unleash/issue/2-1773/db-create-migration-for-a-new-observable-events-table

Adds a new DB migration to create a new `observable_events` table. Even
though we are thinking long term with the `source` columns, the short
term purpose of this table will be to store incoming webhook calls.
2024-01-03 12:08:14 +00:00
Gastón Fournier
2a1c0616e0
feat: support null created_by_user_id (#5744)
## About the changes
Creating an incoming webhook with an admin token means we can't
correlate the action with a real user. In this case we should support
null.
2024-01-02 17:53:29 +01:00
David Leek
1dadd23594
chore:system user and events created by userid migrations (#5612)
## About the changes

Migrations for:
- Adds column is_system to users
- Inserts unleash_system_user id -1337 to users 

includes `is_system: false` in the activeUsers and activeAccounts where filter

Tested by running:
`
select * into users_pre_check from users where id > -1;
delete from users where id > -1;
`
before starting unleash, then inspecting users table after unleash has
started and verifying that an 'admin' user has been created.

---------

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2023-12-22 11:19:39 +01:00
Jaanus Sellin
d57e26b8ea
feat: feedback table (#5721) 2023-12-21 15:34:35 +02:00
David Leek
33f82daa8c
chore: add migration that renames new created_by columns (#5681)
## About the changes

Replaces #5616

Renamed newly added `created_by` columns to `created_by_user_id` for
these tables:
features
feature_tag
feature_strategies
feature_types
role_permission
role_user
roles
users
api_tokens
2023-12-19 13:14:15 +01:00
Nuno Góis
138d303da4
chore: rename secret to token in incoming_webhook_tokens (#5679)
Renames `secret` to `token` in `incoming_webhook_tokens` for
consistency. This table is not being used yet, so this should be a very
safe change.
2023-12-18 17:11:59 +00:00
Nuno Góis
5f975bbad7
chore: incoming webhooks and tokens migration (#5670)
https://linear.app/unleash/issue/2-1699/db-create-migration-for-a-new-incoming-webhooks-table

Adds a migration that creates 2 tables:
 - `incoming_webhooks`
 - `incoming_webhook_tokens`
2023-12-18 13:22:28 +00:00
Nuno Góis
00ed539c19
Revert "chore: incoming webhooks and tokens migration"
This reverts commit 695474576e.
2023-12-18 11:47:04 +00:00
Nuno Góis
695474576e
chore: incoming webhooks and tokens migration 2023-12-18 11:44:29 +00:00
andreas-unleash
6c52158723
feat: add reason column to change_request_schedule (#5631)
What it says on the tin.

Closes: #
[1-1766](https://linear.app/unleash/issue/1-1766/add-reason-column-to-change-request-schedule)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-12-13 14:07:02 +02:00
David Leek
d632690203
chore: add created by user id to events (#5621)
## About the changes

Adds the column `created_by_user_id` to `events` table and adds index
for it

---------

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2023-12-12 15:57:59 +01:00
Christopher Kolstad
18ea7349c6
feat: add created_by to api_tokens table (#5596)
Adds a migration for adding created_by column to the api_tokens table.
2023-12-11 15:41:36 +01:00
Christopher Kolstad
150e6b03dc
feat: add column created_by to roles table (#5595)
Tracking who creates roles
2023-12-11 15:40:17 +01:00
Christopher Kolstad
4f7b3aa759
feat: add column created_by to role_user table (#5594)
As it says in the title. Adds a created_by column to the role_user table
to more easily track who's doing what.
2023-12-11 15:40:02 +01:00
Christopher Kolstad
0f250ba06c
feat: add created_by to role_permission table (#5592)
As it says on the tin. In an attempt to make all operations in Unleash
traceable to an originator. This PR adds created_by to role_permission,
which will show which user assigned a permission to a role.
2023-12-11 15:39:44 +01:00
Christopher Kolstad
ed220c0b89
feat: add column created_by to users table (#5597) 2023-12-11 15:39:07 +01:00
David Leek
5b6a26a828
chore: migration for features created by (#5593)
Contains the migration that adds the column created_by to `features`
2023-12-11 14:58:23 +01:00
David Leek
427abbd8d1
chore: add migration for adding created_by to feature_types table (#5591)
Contains the migration that adds the column created_by to
`feature_types`
2023-12-11 14:57:58 +01:00
David Leek
0f1b89b259
chore: add migration for adding created_by to feature_tag table (#5590)
## About the changes

Contains the migration that adds the column created_by to `feature_tag`
2023-12-11 14:57:40 +01:00
David Leek
27732274a3
chore: add migration for adding created_by to feature_strategies table (#5589)
## About the changes

Contains the migration that adds the column created_by to
`feature_strategies`
2023-12-11 14:57:18 +01:00
Nuno Góis
023db4e2c9
refactor: favor permission name over id (#5409)
https://linear.app/unleash/issue/2-1664/create-db-migration-that-favors-the-name-column-over-id-for

Similar to https://github.com/Unleash/unleash/pull/5398, but
non-breaking (semver).
This keeps the permissions `id` column intact, however favors the
permission name whenever possible.
2023-11-27 11:12:09 +00:00
Fredrik Strand Oseberg
a8ea8d3fbe
Fix/clean last seen environments (#5402)
This PR addresses some cleanup related to removing the
useLastSeenRefactor flag:

* Added fallback last seen to the feature table last_seen_at column 
* Remove foreign key on environment since we can not guarantee that we
will get valid data in this field
* Add environments to cleanup function
* Add test for cleanup environments
2023-11-23 12:12:58 +01:00
Nuno Góis
88a034d066
fix: dedupe any duplicate permissions (#5397)
https://linear.app/unleash/issue/2-1656/create-db-migration-that-ensures-correct-state-of-permissions

This adds a migration that dedupes any duplicate permissions.
2023-11-23 10:23:21 +00:00
Nuno Góis
5dc3e830a8
feat: add CREATE_TAG_TYPE permission (#5386)
https://linear.app/unleash/issue/2-1164/update-tag-type-covers-both-creation-and-update

Adds a new `CREATE_TAG_TYPE` permission instead of using
`UPDATE_TAG_TYPE` for both actions.
2023-11-22 10:20:19 +00:00
andreas-unleash
95245c4413
chore: remove enum type from db (#5254)
Changes the change_request_schedule `status` column to text. 
Drops the custom type

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-03 09:28:19 +02:00
Ivar Conradi Østhus
50ddb365b9
fix: make sure we are still pg10 compatible. (#5214)
`EXECUTE FUNCTION` was introduced in Postgres v11. In Postgres v10 the
syntax was `EXECUTE PROCEDURE`. This fix changes the syntax to `EXECUTE
PROCEDURE`, which is perfectly fine sense our function does not return
anything.
2023-10-30 13:19:57 +01:00
andreas-unleash
6875daf157
feat: add created_by and status columns to change_request_schedule (#5203)
Adds 2 columns to change_request_schedule

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-30 12:01:06 +02:00
Thomas Heartman
a5d304ca51
1-1531: create db table for cr schedules (#5148)
This PR adds a db table for CR schedules. The table has two columns:
1. `change_request` :: This acts as both a foreign key and as the
primary key for this table.
2. `scheduled_at` :: When the change is scheduled to be applied.

We could use a separate ID column for these rows and put a `unique`
constraint on the `change_request` FK, but I don't think that adds any
more value. However, I'm happy to hear other thoughts around it.
2023-10-25 14:36:03 +02:00
Jaanus Sellin
7039160af0
fix: project mode can not be set to null anymore (#5145) 2023-10-25 14:09:34 +03:00
Nuno Góis
957546e305
refactor: rename message banners to banners (#5098)
https://linear.app/unleash/issue/2-1531/rename-message-banners-to-banners

This renames "message banners" to "banners".

I also added support for external banners coming from a `banner` flag
instead of only `messageBanner` flag, so we can eventually migrate to
the new one in the future if we want.
2023-10-19 13:18:25 +01:00
Nuno Góis
66304cf8e7
feat: message banners table migration (#5009)
https://linear.app/unleash/issue/2-1485/db-create-migration-for-a-new-internal-message-banners-table

Adds a DB migration for a new `message_banners` table.
2023-10-12 11:27:00 +01:00
Christopher Kolstad
1edd73db45
feat: feature changes counted in new table (#4958)
As part of more telemetry on the usage of Unleash. 

This PR adds a new `stat_` prefixed table as well as a trigger on the
events table trigger on each insert to increment a counter per
environment per day.

The trigger will trigger on every insert into the events base, but will
filter and only increment the counter for events that actually have the
environment set. (there are events, like user-created, that does not
relate to a specific environment).

Bit wary on this, but since we truncate down to row per (day,
environment) combo, finding conflict and incrementing shouldn't take too
long here.

@ivarconr was it something like this you were considering?
2023-10-10 12:32:23 +02:00
Fredrik Strand Oseberg
d896dbd0c7
Fix/last seen at by environment (#4939)
Initial architecture for last seen at by environment.
2023-10-09 10:54:00 +02:00
Mateusz Kwasniewski
296cc9a9f2
feat: update dependency permission (#4910) 2023-10-04 09:27:14 +02:00
Nuno Góis
4167a60588
feat: biome lint frontend (#4903)
Follows up on https://github.com/Unleash/unleash/pull/4853 to add Biome
to the frontend as well.


![image](https://github.com/Unleash/unleash/assets/14320932/1906faf1-fc29-4172-a4d4-b2716d72cd65)

Added a few `biome-ignore` to speed up the process but we may want to
check and fix them in the future.
2023-10-02 13:25:46 +01:00
Gastón Fournier
f9c3259083
fix: partial index on events announced (#4856)
## About the changes
Add partial index on events by announced. This should help avoid `Seq
Scan on events` when the majority of events are announced=true

---
Co-authored-by: Ivar Østhus <ivar@getunleash.io>
Co-authored-by: Gard Rimestad <gard@getunleash.io>
2023-09-28 10:21:16 +02:00
Fredrik Strand Oseberg
ebb76a5354
Feat/reset pnps (#4841)
This PR resets pnps prompts by removing entries in the user_feedback
table
2023-09-27 12:03:02 +02:00
Mateusz Kwasniewski
be7f0d8b4e
feat: Persist dependent features (#4772) 2023-09-19 13:01:38 +02:00
Thomas Heartman
73b7cc0b5a
1-1319: add feature naming pattern descriptions (#4612)
This PR adds a feature naming pattern description to the project form.
It's rendered as a multi-line input field. The description is also
stored in the db.

This adapts most of @andreas-unleash's PR #4599 with some minor changes
(using description instead of prompt). Actually displaying this data to
the users will come in a later PR.


![image](https://github.com/Unleash/unleash/assets/17786332/b96d2dbb-2b90-4adf-bc83-cdc534c507ea)
2023-09-06 08:13:28 +00:00