We study the stability of mean-motion resonances (MMR) between two planets during their migration in a protoplanetary disk. We use an analytical model of resonances and describe the effect of the disk by a migration timescale (T-m,T-i) and an eccentricity damping timescale (T-e,T-i) for each planet (i = 1; 2 for the inner and outer planets, respectively). We show that the resonant configuration is stable if T-e,T-1/T-e,T-2 > (e(1)/e(2))(2). This general result can be used to put constraints on specific models of disk-planet interactions. For instance, using classical prescriptions for type-I migration, we show that when the angular momentum deficit (AMD) of the inner orbit is greater than the outer's orbit AMD, resonant systems must have a ...