1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-04 14:13:28 +01:00
bitwarden-server/util/Migrator/DbScripts/2023-11-14_00_2019FamilyPlanPremium.sql
Conner Turnbull e99250348a
[AC-1827] Organization PlanType Index (#3447)
* Reverted accidental change that granted premium to Families 2019 plans

* Removed transaction and added a plan type index to organization

* Removed index

* Added IDs for organizations that should keep UsersGetPremium

* Updated to store IDs in temp table
2023-11-27 13:12:57 -05:00

348 lines
15 KiB
Transact-SQL

CREATE TABLE #ExcludedOrganizationIds
(
ExcludedId UNIQUEIDENTIFIER
);
INSERT INTO "#ExcludedOrganizationIds" (ExcludedId)
VALUES
('dec8ffc3-24a8-4b5a-b057-ab7300c1ca1a'),
('cc4b8cdd-1202-49de-8830-ab6201160e64'),
('4dd79e1b-f687-431b-95b6-a9bf00bb9fa4'),
('b285df2d-303a-4ca9-ae67-aa96014738d1'),
('59f91ca0-648e-4cc9-a510-abf100ec1a21'),
('3ed5120e-83c2-4dcc-8b23-ab38014a0d91'),
('64dc181b-1d13-477f-8195-abd9012a26f4'),
('872ded84-c905-4b41-a2c0-ab340025b753'),
('3c711cd5-9637-405f-ae33-a9f90160ec48'),
('938521e7-ebf4-495a-843c-ac0b002af359'),
('ad471cd9-43bf-453f-a821-aaa60080ebd8'),
('8d84fe07-4c33-49fc-bd50-abe600d6abc0'),
('69260dd7-c3b9-4ee6-befa-abe70119b6b1'),
('f4d59aa4-27a2-4069-8136-abe20045bb1b'),
('d4c08576-3445-448c-85d1-ab4d0177ac62'),
('7e551c84-de10-47c7-99c3-ab9900ad52ba'),
('11a89fd8-f7ea-4a2f-bb1c-ab960148a39a'),
('adf816aa-a718-4475-9d59-aa69001243ed'),
('688290e3-4f87-4971-b33d-aa960132138f'),
('2f9b37eb-8369-400a-be9d-abb600b9ac35'),
('378c2fcf-7743-4a62-b5b8-ab53002f7aed'),
('a7484c44-b4c7-4929-ad68-aa6e01722fcd'),
('dbe92020-ac0a-4c77-b6a3-abe20011b0e8'),
('caf23986-c99b-46ae-8a5a-aac601429d19'),
('4edda88e-7237-4133-bbf6-abd40071877d'),
('c590bb09-a0ff-4fb4-afc7-aad800ffc0b3'),
('85961861-cf32-438b-9f37-ab2800d1b157'),
('5f85c290-a5f0-4a0c-b30b-a9bf010dd303'),
('7ae23fb4-2f30-42fb-8086-ac0300975b82'),
('ff01c1e7-ce9d-462b-9ed9-ab740024625e'),
('ecd53779-296e-471f-92b7-abe000d2bf93'),
('46d927ba-50e9-4e35-a7e5-ab440014fc52'),
('b26cd7ce-7ab4-4e65-ac44-ab3600f1fda3'),
('8b4c520f-5fdb-4292-860f-aa8a015a0d85'),
('005998c0-8ade-4413-8a93-ab3600461687'),
('678c0837-9e14-479b-9950-a9da0168a31d'),
('7209856c-f0ed-4e08-a052-ab2a0023e792'),
('adc89934-3aa3-47bf-b97a-ac1400fae3fe'),
('8bc546b2-abfe-4fb6-a35a-aad50177a49f'),
('2b51aa07-eb06-4eb0-8dec-aa6700ccade4'),
('930732ce-5164-45ca-b03e-aa6f0071345c'),
('4752d6da-e8f5-48d5-b7bd-a9c20032af38'),
('49ee2acd-43b3-4bda-a861-aa6e0145ebea'),
('8c3c7513-1683-437b-930b-abdc00e28a6b'),
('28e404dd-691d-4e9b-a36e-a9a800dbf8e7'),
('a393519a-2304-4a6c-878d-abfd003c98de'),
('51c724a9-cd4d-4f69-a70e-a9cd01201c56'),
('5321bf3c-243c-4b7b-8d51-abd30104ed28'),
('3c5db2bf-a62f-40dc-9dbb-abbc006ce471'),
('ab1b5c62-24dc-49f8-84c3-aadf01231826'),
('ce6ce28c-2069-4fdc-9ffb-ab7b002ad05f'),
('ed3b33e8-5598-47d9-8be6-aae201314bbc'),
('5eeeb882-1fcf-41a3-8b59-aa3d010c5571'),
('c12507d6-58a8-4f8a-8735-ab62015dfb39'),
('814bd196-3c53-4d87-9695-ab310188830c'),
('093fd8f8-693e-41a4-81be-a9ac00f1ec56'),
('563d5060-3e5a-4c8e-8d8c-aae4000c41ce'),
('64eeae1c-0393-41ff-8dcc-abfc0153c210'),
('cf1ba000-7559-480b-b975-abb000783cc6'),
('fadc026d-c067-4051-a149-abef011944ae'),
('77894628-1bce-489a-aeeb-ab36014dff46'),
('f46870e1-678f-4f57-86e8-a9da0155ae4e'),
('cbc7f817-910f-4831-bc79-ab7a010e08e1'),
('e9a8ce29-d20b-4db7-aabf-a9db0082966d'),
('8291fa84-197f-4115-8dd5-ab6b0087442b'),
('85b4f183-721b-420e-951c-aa64005c67a4'),
('f4383b65-7e80-499a-9d25-a9dd011aa1dc'),
('48814d2e-2f48-4bbf-91cf-ab5400cf548f'),
('989ca9b1-0ccc-433f-9ac6-ab4e002c0367'),
('8bb6a7f1-3a8b-453c-b86f-ab9b0122b7ae'),
('6db7d379-9157-4345-8570-ac22016b0c03'),
('1dfd63c2-fcc6-467e-8245-ac29014cb601'),
('aefc87e8-8471-4a0c-b878-ab31012676c1'),
('ceaef923-3e77-4d38-85ce-ab6000938d22'),
('714e290e-f6e4-4e70-af94-ac2701848c2e'),
('1ff77c9d-2690-4284-8ca3-ab4001656d79'),
('4f9f25a6-7956-4d2f-872c-aac100141019'),
('790b2b28-043b-431e-8557-ab6d0041a28a'),
('e00ae3ca-9d14-4279-982d-ab8e012e3c03'),
('2fa5aa1a-7f40-4221-8401-aaec01166862'),
('98b048fd-d849-4023-9fe1-aa3f01222d06'),
('50738bf6-7f93-4683-9168-aa3b00db7a69'),
('c21d8376-9188-4d60-ae91-a9d800454c20'),
('f140c244-ca18-4bff-a935-aa100062777a'),
('8b4b8dc7-7d2f-49e1-b4c7-a9ea012b6dd2'),
('90c0c00c-89df-463b-bce2-ab6a015a67ab'),
('d9631977-804b-4f01-94df-ab2600f774ea'),
('b5167b49-ae49-40cc-969a-ab27011a7f05'),
('ce43366b-4a01-450f-be01-aab800be0681'),
('9c256860-a37f-4597-a85c-aa920077b06e'),
('1966f667-d1f1-479f-9c3d-ab8a01722135'),
('444c85ec-95bc-430e-b100-aa430116076f'),
('16874d3a-bcbc-46d6-9293-ab010013604e'),
('0a8e73b8-da61-43de-bdb2-ab140012f879'),
('43990b6d-53fb-4099-80ab-ab84001d5410'),
('4921f98e-b441-42c9-89a2-ab5a0187401b'),
('5a9016f4-e155-4ed7-beb8-ab51003e6fcd'),
('8f85aff5-b8ee-4b3a-8950-aa6d006d2238'),
('d0b1665a-15a8-4a58-a37b-ab2401175b0b'),
('57e8447e-6cb6-49c4-9708-abea00296a38'),
('1fa32803-3e54-410d-8594-ac0d01438493'),
('962d76b8-dd2e-46ae-be6d-aab3012774c1'),
('50756ed5-01b6-445d-94ea-aa4c003fde85'),
('e788d585-c1f4-4d5e-9e5b-ab8c0167ff2c'),
('10feb09f-e7ce-4531-b6c7-ab69008de5d9'),
('b024e551-e2c5-4e79-9b2a-abc501753ebd'),
('e4f8f012-5485-44b4-ad15-ab2b012c56f4'),
('70f70af9-a9df-4f94-8df5-aa7b013da30f'),
('da904974-d064-4ea6-b421-ab3c0062b2a1'),
('1a457b86-1b4d-4df3-941a-ac100171bcec'),
('f94c10a0-b1d6-4660-bf23-ab7f01563fdd'),
('522ef599-ba76-4e54-99a7-a9c60109dc2a'),
('2ab7633e-6595-4ebd-b846-ab5a000610d0'),
('f838ca0e-8899-477f-b2a1-aa82014a1e79'),
('1b3a38ad-8ade-461f-be5d-ab2100f4eced'),
('97b71898-ab5a-4143-a4e2-aa21009c34de'),
('4f9ba2ec-cfd6-4026-9dfc-a86c0083d392'),
('be037379-16bf-4d00-b7dc-ab2b00fc1f2b'),
('076a9689-3458-462f-a815-ab45006ceeb9'),
('b3a4a265-bcc0-4ba1-9064-ab3b0066cdf5'),
('2adaa463-12de-49e6-bc5b-a9cc013b1edf'),
('57a391a2-fcfd-4a55-a368-a9f4018084f1'),
('ba5e7dc8-ffad-4e1d-bf86-a9dd00db663f'),
('aec81da6-b3a3-47fa-a4f0-aa4b017282dd'),
('784a4ae0-7146-4c99-bfb8-aafb00ee96c2'),
('27cd6a36-4a57-44f2-8563-aa3200dcf192'),
('3eaf4fbf-b0b1-4721-a162-ab1501095f5c'),
('801bfc2e-3897-41fa-aa2e-ab7001710542'),
('d9e23223-e684-477e-9949-abcd0139c0a9'),
('12fe7de2-8307-4766-99e6-a93300bcf099'),
('7568f7ba-895a-4c05-8e64-aa6c00ea4235'),
('6dd393b7-361f-400b-9a80-ab9a00714ed6'),
('63fbe2c1-91cd-4a61-adb3-aaec00f36aed'),
('4d77c08c-c0e5-40e5-8a31-abf5018251c2'),
('122f82ea-7d70-4f59-80a7-ab78000ee706'),
('9f9f6ddc-ac72-4a69-a485-abcc0040847e'),
('e99dbfe8-f076-400f-ae39-aafe00646378'),
('32f6c959-c6de-4544-846c-ab9801072d91'),
('948598be-1aa5-4667-ace8-aa65001d9ff8'),
('d40cb526-c481-4f46-9679-aad50110c9f8'),
('8ee54097-bfd3-46f0-ab3a-abbd010b2cd8'),
('d112f3e4-ed83-4ebb-8dcf-ab9e003c0945'),
('ca7496bd-f3c7-49f4-8cbf-aa80011382d6'),
('5243d4d7-274b-4d7d-b5a0-ab2f00338f60'),
('1fa29add-b653-467f-b517-ab960083b799'),
('bdf49b46-d7d7-42f5-9b5f-ab790125bdf3'),
('11671684-b6a5-403e-93f1-aaac000a6cfe'),
('59982841-8b15-439f-a105-ab2a0169d736'),
('fc4d85f7-5d76-4cbb-855d-aa600054c37f'),
('8eee78ce-e632-4430-aa04-a9d300f97f97'),
('2cdc37fe-61b9-46ac-b12e-ab7401421789'),
('9a391088-4dd9-4738-b5e9-ab7a01174e00'),
('8f0f69e0-d578-48bf-8234-ab6d00f671c4'),
('12314ee1-c386-434e-b116-ac0700ec705e'),
('9dc2e193-cf50-4f5c-ab27-aa6b01356aaa'),
('de57fdc7-ea93-459f-aa8d-aa420103fb24'),
('ec4f6871-3b2e-4c82-b075-aa1501516892'),
('05cfc1ce-4c86-4417-ac00-ac2b0080b915'),
('c58b3f75-4538-4383-8182-a9c8014f28bf'),
('a22a1fd4-30ee-4b7d-ab25-aa3e00e2025b'),
('db0595d1-3324-443f-b5e8-abee0093aef0'),
('dd96260f-d6e7-4231-a4f3-abdb003eda43'),
('9ce5c9e4-0fb3-451b-a419-aa7700527945'),
('366ae645-74f0-4105-9ce9-abc500b25b7f'),
('19e26466-2c02-4ee3-b25f-ac0e0160c9fc'),
('49666734-d5be-4d2b-8281-a9f700792a9e'),
('8109068e-7ca6-4e53-9d61-aa66011a45b9'),
('ba3810d3-c270-4dac-9e5f-ab66000c6317'),
('37ad9eee-026f-4c0b-a5ba-abe60168fffb'),
('f53ee7b2-e39a-4ddc-9194-aa1e010ab904'),
('2458cb30-09b4-44b9-b2f8-aa3501779846'),
('e32ad579-240e-4513-986e-aa4801340a90'),
('30ff7813-f4e3-4da4-8a8a-ab86014f982b'),
('06302a61-8ce7-4c66-bc9a-ab17016ca41e'),
('ff8dcbe1-bbc5-4013-9acc-aa13004d0e40'),
('e0eaa125-62f1-4dd2-baf5-aa2b0149b99b'),
('703d1977-705a-458d-b5c4-aa780051591c'),
('c49acc11-b581-410d-ba6a-ac2b01845320'),
('81084b94-1864-49a7-b877-abf30075264f'),
('ca41609f-0ef2-4268-94ba-aa9e00e0560e'),
('878ed95a-97e2-484e-9df9-ac230174b114'),
('2d58037d-4316-419e-b27c-aac00110c143'),
('22e7f61b-fee0-4e82-9fa2-ab7c00b577a0'),
('f24923f6-c3dc-4ce4-a3df-a9cf0089e0a1'),
('e48376fc-fcaf-40f7-aeb3-abea002c4617'),
('c1e3762e-f924-4649-bfed-abc500e77037'),
('f120a27d-07fc-4728-a359-abcd01258ae1'),
('07b961d2-6504-492d-afdb-a9f1013a848f'),
('d997745b-d826-4033-94e1-aaf10139c310'),
('0b772d98-4bdf-464e-9f4b-aba300430074'),
('1dfefb50-a730-4cc0-962b-ab7f01482a5b'),
('d4f5ae17-c1d7-4365-872a-abe700eed375'),
('da21de5a-1102-40a7-bbd4-aba60031a252'),
('e600b97f-e88d-4bb5-9095-aa6e004d147c'),
('d7317618-7c3d-4cad-bc08-ab2e005c3e1a'),
('45d45b24-f2c9-450b-a6fd-abe6011a6086'),
('0f2006bc-cd44-438f-8f9a-a9f301611824'),
('17677f01-e186-42a8-8bbd-ab30005d298f'),
('71c08801-8485-459e-8893-ab9e0010e6c7'),
('026a23b8-6130-4011-bfa1-ab190053b4a0'),
('6a2bd5b7-5b7c-4e31-b44e-abe3018b1811'),
('bbc6bebb-2dba-4b38-9289-abdf0148f0ca'),
('b9013ae4-eaf9-40f3-8fb9-ab80012abcc2'),
('3c7c92f6-6554-43bb-a711-ac21005f8db9'),
('455d535d-d68f-4146-89b1-ab3b017be189'),
('bc5dbd3c-b595-473a-a79a-ac1b00209e3f'),
('b538c147-2e69-4107-a555-ab4c01167177'),
('73832978-6ad4-4d0e-865e-ab39017cce9f'),
('ed26a566-ea31-4861-8d1f-ab3b012e621f'),
('08b0e0a9-ba20-4e58-8660-ab6c0162bf75'),
('cb5d18de-6e5e-4a7e-83c0-a9be0034e30e'),
('52515b20-8b77-48e7-b88a-abca015f6a3a'),
('f15b6c1d-bb2d-4851-8e36-ab1a014618bf'),
('a0df784e-6e0f-46ad-af70-aa170091958a'),
('2cab64a2-8322-46e4-9e20-ab22010c5fc2'),
('8e60660c-7e7d-4f2a-b049-abf000045450'),
('099fd470-a789-437f-8645-aaab01432218'),
('7693b8de-e778-44b7-84e9-aaaf0119db35'),
('9ae61ef1-ffc6-4ea2-99e3-abe8011785e2'),
('0204e23e-196a-4a70-9184-ab7f00145931'),
('ac4a9a5b-7545-4a45-ab2e-abe800205f5a'),
('af9ba60f-026c-47df-8bcd-aa120148a1d0'),
('d9fabc70-b404-4054-b674-ab7d0121f7b1'),
('09fa21ae-94b9-4a60-a3cc-a9e6015b7a9b'),
('c48b072a-3406-484a-86e0-ac0f00440b2d'),
('bd5f0301-46b0-4839-a6e2-ac0a01485b1d'),
('511741ca-4196-410e-a1aa-ab31014eb5d6'),
('6467ac4b-eeb0-4254-86e1-ab4d0180dea8'),
('945982f2-96c6-4f5a-9a10-ac09004c863d'),
('25440cae-5006-4230-b99c-aa73014ad0ae'),
('14653120-4391-407e-8fb7-abb200f89271'),
('387ab0f4-ec9c-47ea-9123-ab7a01047e31'),
('1fbdf873-49ec-4d07-9c97-aa680121b7af'),
('aea59245-403c-4387-b992-aae00116db12'),
('4d9a2c12-0d2a-442c-929f-aa6100005803'),
('4aa72634-dd58-4a93-837d-ab7b00b1c5bb'),
('e215be2d-d26b-484e-b907-ab870008712b'),
('84928852-71b4-4cfe-a07d-aaca0119357c'),
('c06cfde6-0396-4efe-b816-ab740043a155'),
('44071b57-7d58-419a-9020-aa070124916f'),
('017ad965-3fad-4016-9a20-aed0011c6de5'),
('c1dfb0f6-da6c-4e5f-9044-aa40001d6090'),
('3344b929-68db-4822-abcf-aabd01442fa3'),
('ecc3287d-b258-4c87-87d5-ab08015847fe'),
('20e9e399-53bd-49a7-a9d6-ab4d017a463d'),
('719ba2b6-9d00-4b87-a21b-ab9100376c90'),
('cea86f88-38e9-40df-ad08-aaeb014561f8'),
('325501f9-c3a0-45ae-8122-aadf00611651'),
('1109258c-3aef-4c15-9da2-abef014da457'),
('c3f4b2c5-c102-4fce-abda-ab0100dca585'),
('4109f60f-29a2-4073-93e6-aa9c0161dce4'),
('8fa02b36-4bbd-4d23-b5ed-ab5b002e7f0d'),
('32b3fbf5-4064-4ebe-baa7-aaa10162d934'),
('d60ac752-52e4-43d8-9b07-abda00bf6d0a'),
('a630205c-3ef9-4e54-94ac-aa7500ffd21d'),
('28bfc80e-070d-4d67-be39-ab78017a08b4'),
('d8c575b4-e4b1-43f7-8b7c-abeb001e073e'),
('8b2dc254-4a96-44f6-b84e-aa9401488c1c'),
('142bc8e5-b78b-4239-bd3d-aa0000263c41'),
('2556e04a-5ce9-41c6-8495-ab3e0146aa75'),
('61cc3d0b-5f60-4ee8-8218-a9ca016e64cd'),
('e44d3c3e-c750-48ef-beac-abe30158ae78'),
('9b4d719c-ee4b-41ee-9f01-ab6200c68782'),
('2680b593-5040-4d2a-ab61-aa6400a085d5'),
('6a5b05ec-580c-4fc3-b786-aaf500ee50a4'),
('e2cc24d8-bdff-406f-b8aa-ab51009710b2'),
('4d73092d-f5f3-4862-bf30-ab9e002d246f'),
('31124285-f18c-463d-896d-ab3801897e2a'),
('9b760a25-497f-4720-a136-aa12010654d9'),
('a5a8f5ba-17da-486e-b927-ac1a00c167de'),
('c332ecbd-3110-4344-bb94-aafc0176748f'),
('945beef5-f722-417e-b9af-aa920106c659'),
('13b0301d-09f3-4e9e-affe-abf500d660a9'),
('2b0b510b-17c5-4ac9-9a9f-ac1b0061936e'),
('75d3f88c-b16e-480c-832e-aaf0010adcdd'),
('675ea811-d203-4fa9-b94d-abe800713a28'),
('7c93777c-8be6-47dd-add5-ab6e0019d2b1'),
('deb7c7e7-dcba-49df-b047-aa5b01240c2f'),
('fb3b0dd9-dad9-4c78-a5cb-ab4f009d6c1f'),
('920b2e34-9a52-4ad1-9ac8-aa7c01490016'),
('3652c135-e6be-4bbb-ae18-aa130137f504'),
('b835940f-cab6-4224-9b23-ab260178dd9c'),
('b81d7501-6e41-4304-b4b3-abb9000066b2'),
('9e6cb7fe-352b-4a16-8560-abf5017368c9'),
('c625cf22-4c96-43ea-a433-a98c012db602'),
('07faa9ee-0577-408b-ae10-abca00862b2b'),
('799c8e15-c9bd-4e7e-9b1e-aba3011b6ff5'),
('849f5413-5b95-4976-b046-abac01597398'),
('28bea5ac-518d-46af-a9ad-ac77013792c7'),
('a4ccc9f3-da48-43c3-92c0-abe401329e23'),
('b5f5475c-5a8b-42ea-a33c-aabe004b57a6'),
('4e09c899-23af-4a13-b34b-aa1000bf5840'),
('b17cc0dd-6af0-40de-99de-aa3900f5b481'),
('940ff4d2-92a8-4ac5-9e93-ab8b01186109'),
('8a7358ed-9e34-4f33-9e54-abc00084e8ae'),
('ef529c37-25cd-4299-9bef-a9f700ef2834'),
('d3c92366-4e93-482b-b31e-aa48011781d2'),
('8c032a55-842b-4418-8582-aaa301399df6'),
('4b050547-c46c-4ca7-9051-abb40034b6ed'),
('aa72125a-d081-45e0-a106-ab4f016813d6'),
('e438b101-b88b-4446-aba5-aacc01840144'),
('4c312a51-119a-46af-a04c-ab790184dc14'),
('66de69da-c82b-493d-9e1b-ab25015316c9'),
('b28bf58e-675e-49f7-89ef-ab0e01755296'),
('3d1398a6-af73-4f79-b9b7-abe900647c6e'),
('733c96c3-b8b8-49f9-b745-ab3c00d75e9c'),
('8fcfd6cc-59bc-4b7a-ab6a-ab77002342e9'),
('a71df7d2-22d0-41ae-9fab-ab57001f4c43'),
('8d16f977-b6b9-4b8a-86d4-aa89007d3453'),
('029f2e3d-0332-4a66-96e1-ac0800a24084'),
('4e78b2d8-91c5-4ca1-b0c0-aad801044233'),
('0c2417f2-a5b8-4b84-878b-ac0b00c0461d'),
('f9a0714d-9901-4d64-b08f-abdb00f9453a'),
('3d2452bb-d376-485c-b3c4-ab470090afe4'),
('317f9615-ac24-4b53-baf0-ab69018330f2'),
('557aed8a-edb4-4600-9539-ab410165b4a6'),
('1f0d35ea-a585-41f5-b258-ab99003cd4cb'),
('cecf9e04-4ff8-41b1-88c8-aab50096e57a'),
('891b35c0-7af5-4bcc-9a03-abd200a48723'),
('7937ae0a-4f38-48b0-b39e-aa93015d681c'),
('69829207-9194-47e0-a012-ac07004e2302'),
('70f3068c-2db6-409c-b831-ac110103bf26'),
('9f72a10b-377a-4381-8b9e-abd3005a650f'),
('f935bdae-3147-46f3-a5b7-aba60106fad6'),
('4e234f3e-a0f5-4f17-9740-aa5500115b73'),
('605483a8-dc42-43ac-8a53-abe30133858c');
UPDATE
[org]
SET
[UsersGetPremium] = 0
FROM
[dbo].[Organization] AS [org]
LEFT JOIN [#ExcludedOrganizationIds] AS [ex]
ON [org].[Id] = [ex].[ExcludedId]
WHERE
[org].[PlanType] = 1 -- Families 2019 Annual
AND [ex].[ExcludedId] IS NULL;
DROP TABLE #ExcludedOrganizationIds;