SQL 배포 스크립트를 부분적으로 조합하는 문명화 된 방법이 있는지 궁금합니다. 저장 프로 시저 정의가있는 10 개의 파일 (변경하고 디버깅하는 것이 더 쉽습니다), 필드가있는 테이블 목록 및 모든 클라이언트에 대한 3 개의 초기 데이터 집합이있는 것처럼. 또는 더 복잡하고 체계적인 다른 세트에서.SQL 배포 스크립트 빌드
크기가 큰 200k 크기의 스키마 파일이 변경되기 때문에 매우 어렵습니다.
나는 개인적으로 나를 위해 전체 파일을 모은 PHP 스크립트를 작성했다. 따라서 저장된 proc 파일은 다음과 같습니다.
--<?php $procParams = "@UserLogin varchar(50), @RightName varchar(100)"; ?>
--<?php if (!defined('PROC_INNER')) { ?>
if exists (select * from sys.objects where object_id = OBJECT_ID(N'DepriveUserRight') and type in (N'P', N'PC'))
begin
drop procedure DepriveUserRight
end;
go
--returns all the object types
create procedure DepriveUserRight @UserLogin varchar(50), @RightName varchar(100)
as
--<?php } ?>
declare @RightId int
select @RightId = RightID from [Right] where RightName = @RightName
exec DepriveUserRightById @UserLogin, @RightId
--<?php if (!defined('PROC_INNER')) { ?>
go
exec DepriveUserRight 'mgr', 'save_login'
--<?php } ?>
또한 테이블 정의에서 유형을 작성하는 것과 같은 몇 가지 의미를 포함 시켰습니다. 테이블은 다음과 같이 :
addTable('LinkObjectType');
?>
LinkObjectTypeID int not null identity primary key,
LinkObjectTypeName varchar(100) not null,
LinkObjectTypeData varchar(250) null
<?php
endTable();
그리고 실행 명령이
php realSchema.sql > bin/realSchema.sql
이다 (I는 MS SQL 사용하고, 중요한 경우 내 응용 프로그램, 웹 아니다.)
일반적으로 디자인 변경 사항을 쉽고 빠르게 배포하기 위해 Redgate를 사용합니다. http://www.red-gate.com/products/sql-development/sql-comparison-bundle/ – Hawxby
Redgate 도구는 우수하고 아마도 DB와 데이터 패치에 더 적합합니다. 나는 SQL packager에 대해 잊어 버렸다. – Tony